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.
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
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.
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
- Open IIS
- Click on the site you want to accept larger file sizes
- In the main window double click ‘Request Filtering’
- On the top tab right click to see options and select ‘Edit Feature Settings’
- 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.
data-sc-maxrequestlength to see if the value is properly set. An example is shown below:
- Stack Overflow Question: Maximum amount of data upload is NaN undefined