Custom Bulk Media Uploader for Episerver

12.08.16   Oshyn Labs


The new Oshyn.Episerver.Addons.BulkMediaUploader is available now and can be downloaded from NuGet. This add-on is compatible with Episerver CMS 9 or later.

The purpose of the "Media bulk uploader" add-on is to rapidly upload a large quantity of files into your Episerver assets library. You only need to specify the path to the folder that contains the files, and then the add-on uploads them into your CMS automatically.

This add-on is intended for users with access to the server where the Episerver instance is installed, since the source directory (the one where you will copy the files to be uploaded) must be a local folder. By default, it will be shown only to users who are members of the administrator or "WebAdmins" groups.

Once you install this new package, the "bulk media uploader" will be available in the Episerver edit interface, on the left hand pane, as shown below:

The add-on displays the following elements in the "bulk media upload" section:

  • Source folder from the component is going to read the files to be uploaded. This field value is defaulted on the application setting in the web.config file. It is possible to change the path to a different directory.
  • The first checkbox indicates a newly created media alpha folder. For example, when a file named "picture.jpg" is being processed and this flag is checked, then a folder is created with the first letter of the file "P" in the media asset panel and the file is copied inside of it.
  • The second checkbox indicates the component to delete the files from the source folder after they are processed and copied to the backup folder.

Once the upload process has been finished the section "process result" is shown and the user is presented with the following information:

  • The "result" shows you the result of the uploading process:
    •  It will read "upload process completed" if there are no errors. 
    • Otherwise it will read "upload process completed with errors"
  • If there are errors it will list the files that failed during processing.
  • If there are empty directories within the source directory, those will be created in the CMS but the user will be shown a warning.

  

Errors are displayed on the screen but also saved in the Episerver log. Below you will find the list of possible errors:

Error description
Error in screen
Error in log
The specified source folder is empty, or the "Source folder" text box doesn't have a value

ERROR Oshyn.Episerver.Addons.BulkMediaUploader.Plugins.UploaderPlugin: The source folder is empty
The backup folder specified in web.config file doesn't exist in the server

ERROR EPiServerSiteTestAlone.Plugins.UploaderPlugin: BackupDirectory folder doesn't exist. Please create the folder in the path defined in the web.config file
A file extension is not allowed in Episerver

ERROR Oshyn.Episerver.Addons.BulkMediaUploader.Plugins.UploaderPlugin: File not upload problem with the file extension: about-find.jpg
The name or extension of the file to be processed is empty

ERROR EPiServerSiteTestAlone.Plugins.UploaderPlugin: File name/extension empty: best_practices_What_Customers
General error in case of some exception when a file is processed

ERROR EPiServerSiteTestAlone.Plugins.UploaderPlugin: Error detail inner:"Name in URL" with value "b2b-executive-playbook.jpg" is already in use by b2b-executive-playbook.jpg (59972).

The possible warning is the following:

Warning description
Warning in screen
A folder is empty in the source. The message: "Directory [directory name] was created empty" is displayed.

The new settings of web.config that uses this add-on are as follows:

Setting name
Description
UploadFolder Source folder from where the component is going to process the files to be uploaded.
BackupFolder

Backup folder where the files will be copied once they are processed.

Note: Make sure you create the "BackupFolder" on the path specified on the web.config file.

NumberThreads

Number of threads to process the files simultaneously.

Note: Pay special attention to this value because this is going to impact the performance of your CMS. This is because there will be x number of concurrent processes consuming resources on your server during the execution of the upload.

Try this new add-on and let us know what you think. In the future we will release a version of this add-on for editors, so it can be used to bulk upload files from the user computer. If you have any questions about the installation process, feel free to contact us and ask. Otherwise, feel free to check out our Episerver services