I am using jQuery-File-Upload with jQuery-Iframe-Transport to try to get support for older versions of IE.
I set the forceIframeTransport parameter to true so that it works more or less the same in all browsers, but I do not seem to return data on the server side regardless of the browser when it uses the iframe transport.
I spat out the server request headers and I returned:
array( Host => "*******" Connection => "keep-alive" Content-Length => "0" Accept => "*/*" Origin => "**************" X-Requested-With => "XMLHttpRequest" User-Agent => "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17" DNT => "1" Referer => "***********" Accept-Encoding => "gzip,deflate,sdch" Accept-Language => "en-GB,en-US;q=0.8,en;q=0.6" Accept-Charset => "ISO-8859-1,utf-8;q=0.7,*;q=0.3" Cookie => "*********" )
[ ***** error information indicated; you do not need it;)]
Which view is OK, but $_REQUEST empty (i.e. array() ), and the input buffer is empty too:
$handle = fopen('php://input', 'r'); $file_data = ''; while(($buffer = fgets($handle, 4096)) !== false) { $file_data .= $buffer; } fclose($handle); // $file_data = '';
All this worked fine when I did not use iframe transport, but I need IE support ... does anyone have experience transferring files using iframes and can know why the data is not arriving?
When I use jQuery-File-Upload / js / jquery.iframe-transport.js and forcibly pass it an iframe to Chrome, but the requests don't even get to the server in IE.
When I use jquery-iframe-transport / jquery.iframe-transport.js and forcibly transfer the iframe to Chrome, but this is fine because Chrome supports the correct XHR file transfers and the requests at least get to the server in IE, but the data do not arrive.
I updated my script to support the transfer method:
if(empty($_FILES)) { $handle = fopen('php://input', 'r'); $file_data = ''; while(($buffer = fgets($handle, 4096)) !== false) { $file_data .= $buffer; } fclose($handle); } else { $file_data = file_get_contents($_FILES['files']['tmp_name'][0]); }
But then again, I still cannot get any data in IE, no matter what I do.
When I say "IE", I am specifically testing in IE 8 right now. I need support even before 7. This guy claims support completely in IE 6.