I am having having trouble with FineUploader for cross domain (CORS) submission inside of a hidden iframe (i.e. IE 9, 8). For each cross-domain upload request, the image uploads successfully, but the error message displays, with the IE bugger stating:
No valid message received from loaded iframe for file id 1
In detail now, their blog says that:
All cross-domain iframe-initiated responses must end with the script tag above, and the valid JSON portion MUST include the UUID of the associated file. Note that you must host the iframe.xss.response.js file on an accessible server and reference it in the tag accordingly. When the contents of your response is returned to the iframe tracked by Fine Uploader, the associated javascript file imported by the script tag above will be executed, and will pass the JSON portion of your response to the uploader via window.postMessage.
Ok, so I implement this as follows:
if(!isset($_SERVER['HTTP_X_REQUESTED_WITH'])
|| (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest")){{
header("Content-Type: text/html");
$result['uuid'] = $uploader->gen_uuid();
echo json_encode($result);
echo "<script src='http://example.com/js/iframe.xss.response-3.3.0.js'></script>";
}
Now, Fiddler says the response is as follows:
HTTP/1.1 200 OK
Date: Sun, 17 Mar 2013 03:26:49 GMT
Server: Apache
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: PHPSESSID=VJ3AgTRnMtjAqbxizfXBN3; path=/
Vary: Accept-Encoding
Content-Length: 203
Keep-Alive: timeout=2, max=100
Connection: Keep-Alive
Content-Type: text/html
{"success":true,"uploadName":"_73d05d51b4ab624e3260ef0b289a60bc_NMS_0785.JPG","uuid":"749174c7-e29c-485f-9f6d-cc18d4b5d0fd"}<script src='http://example.com/js/iframe.xss.response-3.3.0.js'></script>
And the IE debugger says:
[FineUploader] Processing 1 files or inputs...
[FineUploader] Sending upload request for 1
[FineUploader] Received iframe load event for CORS upload request (file id 1)
[FineUploader] Received the following window message: '{"success":true,"uploadName":"_73d05d51b4ab624e3260ef0b289a60bc_NMS_0785.JPG","uuid":"749174c7-e29c-485f-9f6d-cc18d4b5d0fd"}'
[FineUploader] Received the following window message: '{"success":true,"uploadName":"_73d05d51b4ab624e3260ef0b289a60bc_NMS_0785.JPG","uuid":"749174c7-e29c-485f-9f6d-cc18d4b5d0fd"}'
[FineUploader] No valid message received from loaded iframe for file id 1
[FineUploader] iframe loaded
Does anyone have any idea what could be going wrong?