Sitecore Media Uploader – Maximum amount of data upload is NaN undefined

Today, I’ve helped a user on Stack Overflow to fix the following error on Sitecore 8.1:

“The maximum amount of data that you can upload is NaN undefined”.

So, I have decided to blog about this issue and how to fix it.

Problem Description

When the user was trying to upload a media using the new Uploader, the error stated above was being displayed on the dialog as shown in the provided screenshot below:


Problem Analysis and Fix

Most of the time, when you have the words “NaN” or “undefined”, they come from a JavaScript file. So, it was the JavaScript which returned the error. The Upload Media dialog is the new dialog since the introduction of the SPEAK Framework. SPEAK makes use of Views as it is MVC based.

In order to know why the error was occurring, first, I needed to know which view was being used to render the Upload Media Dialog. Since, this concerns the upload media dialog, the first thing to do is to search for the word “upload” inside the folder website/sitecore/shell. The search showed the Uploader.cshtml. From the file, we can see the statement:


It clearly shows that it is reading the value from the web.config to retrieve the MaxRequestLength. So, to fix the issue, the following steps had to be followed:

Check if you have set the maxRequestLength from the web.config or you can update it from the IIS.

Web.config Way

Navigate to the path: system.web/httpRuntime and check if you have an entry for httpRuntime. If not, you need to specify one as follows:

 <httpRuntime maxRequestLength=”512000″ executionTimeout=”3600″ enableKernelOutputCache=”false” relaxedUrlToFileSystemMapping=”true” requestValidationMode=”4.0″ enableVersionHeader=”false” />

Note that the length is in kilobytes


  1. Open IIS
  2. Click on the site you want to accept larger file sizes
  3. In the main window double click ‘Request Filtering’
  4. On the top tab right click to see options and select ‘Edit Feature Settings’
  5. Now change the number in the field ‘Maximum allowed content length (bytes)’

If it is present, you may need to increase the length.

For this particular issue, the user was have negative value in data-sc-maxrequestlength="-1024". This was due to the fact that a very large value was used in the MaxRequestLength, which was 2147483647. Changing it to 512000 fixed the issue as long as the `Media.MaxSizeInDatabase` setting is less than the MaxRequestLength.

In brief, for this type of issue, check the MaxRequestLength if properly setup. Also, do not make use of too large value. Finally, you can perform an Inspect Element and go to the Debugger Tab in Firefox or Sources in Chrome and search for the file UploadMediaDialog. Normally, there should be 2. 1 view and 1 JavaScript file. Then, search for the attribute data-sc-maxrequestlength to see if the value is properly set. An example is shown below:




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s