Search code examples
javascriptjqueryajaxasp-classicbootstrap-file-input

Krajee Bootstrap File-Input fails to pass uploadExtraData with large files


I have an ajax upload using file-input that works perfectly for even medium sized uploads (ex: 12mb works fine). However, with a large upload (ex: 40mb) it is either not passing the "extra" form data, or the server-side code (classic ASP) is trying to process them before the upload is complete and the data is passed?

The js is as follows:

$('#file').fileinput({   
  maxFileSize:  45000 ,
  maxFileCount: 1,
  required: true,
  uploadUrl: 'ajax_upload.asp?',
  uploadAsync: false,
  dropZoneEnabled: false,
  uploadExtraData: function (previewId, index) {
      //get checkbox values
      var strShowTo = ''
      showToUserIDs: $("input[name=showToUserIDs]").val(),
      $("input[name='showToUserIDs']").each(function () {
          if ($(this).is(':checked')) {
              thisValue = $(this).val()
              strShowTo = strShowTo + thisValue + ',';
          }
      });
      var formData = new FormData();
      var formData = {
          privateFolder: $('select[name="privateFolder"] option:selected').val(),
          title: $("input[name=title]").val(),
          sendEmailNotices: $("input[name=sendEmailNotices]").val(),
          body: $("input[name=description]").val(),
          showToUserIDs: strShowTo
      };
      return formData;
  },
  });

I dont think its a server setting issue as I have already set the Maximum Requesting Entity Body Limit to 100mb and the Request Filtering / Edit Feature Settings / Maximum allowed content length to 100mb.

enter image description here enter image description here

When I upload a large file, all of the uploadExtraData values are "" in the server-side code. However, they are being listed in the "form data" section of the network inspector in Chrome:

enter image description here


Solution

  • It turned out that the server side code was using a component (Motobit ASP Upload) that was setting the max form size to 15mb

    Dim Form: Set Form = Server.CreateObject("ScriptUtils.ASPForm")
    Form.SizeLimit = 12*&H100000