Reputation: 5688
I have a simple file upload funcitonality in place using knockout, in my durandal website. I upload the file to the server by converting the file to a base64StringArray, then uploading the file using an AJAX post method, i.e.
$.post("localhost/uploadDocument", dataToPost)
I have the following request filtering in place in my application:
<requestLimits maxAllowedContentLength="31457280" />
and
<httpRuntime targetFramework="4.5.2" maxRequestLength="30720" />
So I have about a 30mb file limit.
The problem I am having is with a specific Microsoft Excel file, which also includes some embedded PDF files. This file is 14,887,424 bytes, but when I upload it through my application, Fiddler shows that 49,158,346 bytes were sent, therefore I receive a 404.13 error - where the request is denied due to exceeding the request content length.
Why are so many bytes being sent for this one Excel file with embedded PDF files?
Upvotes: 1
Views: 250
Reputation: 1397
I would compress the string client side using something like:
http://rosettacode.org/wiki/LZW_compression#JavaScript
and then on the server side, decompress it, and perform whatever validation you might be doing to check file size
Upvotes: 1