Using iframe for photo upload
I'm developing a widget which should do photo uploads. After a successful upload the widget should display the newly uploaded photo.
Photos are uploaded using HTTP POST to a REST API. The API will (only) return a XML file containing an atom feed of the uploaded photos. I'd like to read the XML file, parse the URL of the uploaded photo and display it to the user.
I'm currently using an iframe to upload the photo. This way I can keep the user on the upload page until the upload is ready. I'm using jQuery to listen when the iframe has finished loading the XML:
[CODE]$('#fileUploadFrame').load(function() { ... });[/CODE]
The trouble is, I can't get the contents of that XML. I've tried for example:
[CODE]var xml = document.getElementById('fileUploadFrame').contentWindow.document;[/CODE]
[B]Is there a way to read the iframe's content?[/B] Or is there some better way to handle file uploads with or without iframes?
Thank you for your answers.
Re: Using iframe for photo upload
[CODE]alert(document.getElementById("upload_target_mult").contentDocument.body.innerHTML);[/CODE]
but work only in 5 edtion.
Re: Using iframe for photo upload
Just a guess: this could be someway related to the same-domain security policy. As a more tested and cross-compatible approach for file uploads, you may want to try out API Bridge:
[url]http://www.forum.nokia.com/info/sw.nokia.com/id/d697a64f-ddae-4937-8151-be157b542d26/ApiBridge.html[/url]
Pit