blueimp/jQuery-File-Upload — Issue #985: Problem using iframe transport
Author: cjroebuck
Created: 2012-02-02 19:50:21+00:00
State: open

Hi there,

When I forceIframeTransport to true in Chrome, the iframe ajax interceptor kicks in ok and clones the form but the requests content-length is only a few hundred bytes, and the content-type of my attached files are application/octet-stream, not the usual image/png or whatever image type I use.

I don't think it is correctly cloning the loaded file input properly, as a normal request using XHR would be several KB's. Also the input fields value is "".

I have checked the iframes content just before the form is submitted and can see the file input field there. But on my backend, the request is not parsed correctly. Can you give me some tips on what/where to debug to see if I can investigate further?

I initialise like so:

@uploadForm.fileupload
dataType: 'json'
autoUpload: false
singleFileUploads: true
sequentialUploads: false
limitConcurrentUploads: 10
maxFileSize: 20000000 # 20 MB
forceIframeTransport: true

and later in the 'add' callback I set the following properties on the data object before submitting:

data.fileInput = $('#upload_form input[type=file]')
data.formData =
someData: 'mydata'
data.paramName = 'images'
data.converters=
'html iframejson': (htmlEncodedJson) ->
return $.parseJSON($('

').html(htmlEncodedJson).text())
'iframe iframejson': (iframe) ->
return $.parseJSON(iframe.find('body').text());
data.submit()