ng-file-upload file size above 4.5mb

2.2k views Asked by At

I'm at a lost... ng-file-upload works perfectly so long as the byte count is equal to or less than 4193813 with an 11 character filename. If the upload size increases by one byte, the header makes it to the server but not the file.

My code is identical on the client side to Danial's sample. On the backend, I'm running West-Wind.com Web Connection, a Microsoft Visual Foxpro web server.

Looking with Fiddler, both my working and broken tests look identical except for the byte count of the content-length.

I looked at IIS7 Request Filtering and see the default 30mb size is set. Also tried setting it to 16mg and it made no difference.

I'm wondering if this is a chunk size restriction and/or I'm not handling something on the backend in the header correctly... but that is just a guess at this point.

Any thoughts where to turn next would be greatly appreciated.

...based on feedback comment, here is a snippet of my code: (assuming for now, multiple files not possible files[0] below)

Upload.upload({
    url: 'postback794.wcsx',
    fields: oFileFlds,
    file: files[0]
}).then(function (response) {
    // the postback now includes valided uploads
    console.log('upload complete');
}, function (response) {
    //error
    console.log('Error status:' + response.status);
}, function (evt) {
    var progressPercentage = parseInt(100.0 * evt.loaded / evt.total);
    console.log('progress: ' + progressPercentage + '% ' + evt.config.file.name);
    _this.DisplayMessage = 'progress: ' + progressPercentage + '% ' + evt.config.file.name;
});

Here is the HTML:

<button class="btn btn-primary pull-left"
     multiple
     ngf-select 
     accept="text/plain, image/*, application/pdf, application/msword"
     ng-model="VendorsController.AddlDocsFile"
     title="Click here to upload one or more documents.">
 Upload Document(s)
  <i class="fa fa-upload" style="font-size:14px; margin:3px;"></i>
</button>

On the server:

  DO WHILE !FEOF(lhFile)
     lcCommandLine = lcCommandLine + FREAD(lhFile,16484)
  ENDDO

I'm going to assume VFP code is unfamiliar, the FREAD is a low level command that reads a file specified by a handle (lhFile) for some number of bytes (16484 in this case). When end of file marker is reached the FREAD terminates and the DO loop is ended. lcCommandLine should then have the entire hit ready to be parsed.

In the case of ng-file-upload working, I can see all of the test upload. Not the case when the byte count is above the breaking point, the lcCommandLine value is cut off without any of the file upload data (HTTP_CONTENT_LENGTH=906).

1

There are 1 answers

0
Harvey Mushman On

Issue was related to IIS when ASP.NET is installed.

Two settings have to be made in the web.config file. They control the maximum file size. The settings are as follows:

(This first setting which is within configuration system.webserver can be made through the IIS UI under Request Filtering.)

<configuration>
<system.webServer>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="500000000" />
      </requestFiltering>
    </security>
<system.webServer>
</configuration>

This is the second one which is also in the configuration under system.web:

<configuration>
<system.web>
    <httpRuntime maxRequestLength="500000000"  executionTimeout="120" />
</system.web>
<configuration>

Thank you Rick Strahl for your directions of where to go looking...!