We've got a file upload method that's been part of our app for years, but we recently became aware that it is failing when trying to upload larger files. I'm aware of the 16 MB VFP string limit, but these are files in the 4-10 MB range. (The cutoff appears to be 4 MB.)
Here's the html used to launch the request:
<form id="form2" action="awupload.awp" enctype="multipart/form-data" name="Wwwebform" method="POST">
...
<input type="file" name="txtFileName" id="txtFileName">
...
And the back end code:
lcNameField ="txtFileName"
lcFilename = ""
lcFileBuffer = REQUEST.GetMultiPartFile(lcNameField,@lcFilename)
IF LEN(lcFileBuffer) = 0
lcTITLE = "Upload Error"
lcMsg = lcFilename+": An error occurred during the upload or the file was too big."
ENDIF
As I said, this works fine if the selected file is under 4 MB in size. But for anything larger, we just get empty values for both lcFileBuffer and lcFilename.
What can I do to make this work for larger files?
--stein
IIS has file size filters, but if you hit those I believe IIS will throw an error - it shouldn't reach your application.
Setting IIS and ASP.NET Request Size Limits.
+++ Rick ---
I don't see an IIS error, but I went ahead and added that config setting:
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="50000000" />
</requestFiltering>
</security>
That did not affect the behavior - I can still upload files smaller than 4 MB, but nothing larger.
However, I did notice something that may be of interest. All the systems where we've encountered the file size issue were running under the .NET Handler. The same code works fine for all file sizes on our demo site which is still using ISAPI. That might explain why we're just now getting complaints about this even though the feature has been in place for years, since we've recently started a push to move our legacy customer sites away from ISAPI.
Is there a .NET setting that might be impacting these upload requests?
--stein
There are two sets of settings in IIS: IIS and ASP.NET. Make sure you set both... as described in the link I posted.
The default ASP.NET request length in 4096kb (4mb) so this is likely your culprit.
This is 500mb:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<httpRuntime maxRequestLength="500000" executionTimeout="120" />
</system.web>
</configuration>
+++ Rick ---