I'm using jQuery-File-Upload with jQuery-Iframe-Transport to try to get support for older versions of IE.
I've set the forceIframeTransport
option to true
so that it behaves more or less the same way in all browsers, but I don't seem to get any data back on the server-side regardless of browser when it uses the iframe transport.
I've spat out the request headers server-side and I get back:
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 => "*********"
)
[*****
s indicated bleeped out info; you don't need that ;)]
Which look OK, but $_REQUEST
is 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 = '';
This all worked fine when I wasn't using the iframe-transport but I need IE support... does anyone have any experience with transmitting files using iframes and might know why no data is coming through?
When I use jQuery-File-Upload / js / jquery.iframe-transport.js and force iframe transport it works in Chrome, but the requests don't even make it to the server in IE.
When I use jquery-iframe-transport / jquery.iframe-transport.js and force iframe transport it breaks in Chrome, but that's fine because Chrome supports proper XHR file transfers, and the requests at least hit the server in IE but no data comes through.
I've updated my script to support either 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 again, I still can't seem to get any data in IE regardless of what I do.
When I say "IE", I'm specifically testing in IE 8 right now. I need support back to 7 though. This guy claims support all the way back to IE 6.