Have you ever had the need to mass upload media into Sitecore? Maybe you are migrating to Sitecore or your editors now want to upload a big set of images into the media library. Tired of Right Click
> Insert
> Upload File
over and over again?
There are some built-in ways in Sitecore to easily do this.
1. WebDav
Sitecore has supported WebDAV features since version 6.2. You can see a demo of it in this Youtube video.
WebDAV allows users of Web clients such as browsers to manage files on Web servers using Web protocols such as HTTP or HTTPS. With WebDAV, users can drag-and-drop files between the Windows desktop and the browser.
So pretty straight forward. Open up the Media Library, navigate to the folder you wish to upload to, switch over to the Folder tab and then click “Drag & Drop” and then do at it says on the tin and drag the file into the popup from your local file system. You can drag entire folders across and Sitecore will recreate the folder structure.
That is of course, unless you have disabled WebDAV support…
Or you are using Chrome. Switch on over to Internet Explorer for a full fat user experience. And sign this petiton, if we form a rebel alliance there’s still hope for us all.
2. Upload zip
If you have disabled WebDAV for performance or security reasons (like we have) then an alternative solution is to zip up your media (in whatever folder structure you require) and then upload the zip and select the option to Unpack ZIP Archive
. You have to select Upload files (advanced)
to pop up these options.
There is a bug in Sitecore 8 update-3 meaning the options selected in the dialog are not posted to the server including the “Unpack ZIP Archives” option. You can request a fix by quoting Sitecore.Support.439231
.
3. Media Upload Watcher
The final option is to drop the files/folders into the /Upload
folder of the webroot folder. The folder is defined by the following setting in config:
<sc.variable name="mediaFolder" value="/upload" /> <!-- MEDIA FOLDER Root folder of upload folder being watched for new media library files Files copied to this folder (or below) will be automatically added to the media library. Can be site path (ex. /folder/...) or absolute (ex. c:\folder\...) It should be different from Media.FileFolder setting --> <setting name="MediaFolder" value="$(mediaFolder)" />
Copy the files/folders into folder and then wait… Sitecore has a watcher defined for this folder so any new files added here will get added into the Media Library and the corresponding items/folders will be automagically created. It should be noted that the media items will be created in the root of the Media Library so it may be a good idea to upload these in folder anyway.
There’s some info on the Media Upload Watcher on page 65 of Professional Sitecore Development by John West.
If this is working then you may want to go ahead and disable this functionality anyway…
4. Sitecore PowerShell Extensions
Of course, you can even slice bread with SPE! Have a read of the following post by Himadri Chakrabarti on an SPE based solution: