Uploadwatcher may randomly skip some files during upload


Description

Sitecore has a special feature to automatically upload files as items.

By default, you should place the files in the /upload folder. However, you can change the location using the following setting in the web.config file:

<sc.variable name="mediaFolder" value="/upload"/>

Sitecore must be running when you use this feature.

If you try to upload more than 50 files, some of the files may not be uploaded.

This occurs because Sitecore uses the System.IO.FileSystemWatcher object to watch for new files to appear. If too many files are added at once, the FileSystemWatcher’s internalBuffer fills up and starts skipping files. Please see Remarks in the following article: http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx

Solution

As a workaround, use the attached Sitecore.Support.323775.dll file.

  1. Before each occurrence of the following string:
    <add type="Sitecore.Resources.Media.UploadWatcher, Sitecore.Kernel" name="SitecoreUploadWatcher"/> 
    Add the following one:
    <add type="Sitecore.Support.UploadWatcher,Sitecore.Support.323775" name="SitecoreUploadWatcher"/> 
  2. Comment out these lines:
    <add type="Sitecore.Resources.Media.UploadWatcher, Sitecore.Kernel" 
    name="SitecoreUploadWatcher"/>
  3. Place the Sitecore.Support.323775.dll file into the /bin folder of your web site.
  4. In the web.config file, add the following string under the <settings> section:
    <setting name="FileSystemWatcherBufferSize" value="4096000"/>
    This value should be sufficient for 5000 files, but you can increase it further to make sure that also files with long names are uploaded. For example, if a full file path contains 100 symbols in average, it will take 200 bytes per file. Thus, 32000 files will take 6400000 bytes (6250 kb). So the setting value should be as follows:
    <setting name="FileSystemWatcherBufferSize" value="6400000"/>‌