Sitecore - Download two files with the same name but with a different extension inside the zip file

I want to upload 2 files with the same name but with a different extension, I want to put them in a zip file, and then use sitecore to extract all the files to the sitecore library.
I am using sitecore 7.2. Any idea how to do this?

+4
source share
2 answers

You can use the option Upload Files (Advanced)and then select Unpack ZIP Archivesin the download dialog.

Upload Files (Optional)

Unzip the ZIP

The file will be downloaded, the archived unpacked and resulting files will be separately listed as separate elements:

Uploading files with the same name

, , , Sitecore "" () , , , .

Media.IncludeExtensionsInItemNames=true config MediaRequestHandler, : Sitecore.

fooobar.com/questions/1599805/....

. Unpack ZIP Archives, , Sitecore 8, Update 4 (, ). .

+6

asp.net zip -.

Sitecore ZipReader zip -:

 using (ZipReader zipReader = new ZipReader(str))
 {
                foreach (ZipEntry entry in zipReader.Entries)
                {
                    if (entry.IsDirectory)
                    {
                        continue;
                    }
                    MediaUploadResult mediaUploadResult = new MediaUploadResult();
                    list.Add(mediaUploadResult);
                    mediaUploadResult.Path = FileUtil.MakePath(this.Folder, entry.Name, '/');
                    mediaUploadResult.ValidMediaPath = MediaPathManager.ProposeValidMediaPath(mediaUploadResult.Path);
                    MediaCreatorOptions mediaCreatorOption = new MediaCreatorOptions()
                    {
                        Language = this.Language,
                        Versioned = this.Versioned,
                        KeepExisting = !this.Overwrite,
                        Destination = mediaUploadResult.ValidMediaPath,
                        FileBased = this.FileBased,
                        Database = this.Database
                    };
                    MediaCreatorOptions mediaCreatorOption1 = mediaCreatorOption;
                    mediaCreatorOption1.Build(GetMediaCreatorOptionsArgs.UploadContext);
                    Stream stream = entry.GetStream();
                    mediaUploadResult.Item = MediaManager.Creator.CreateFromStream(stream, mediaUploadResult.Path, mediaCreatorOption1);
                }
            }
    }
0

Source: https://habr.com/ru/post/1599803/


All Articles