optikalefx Posted December 23, 2009 Share Posted December 23, 2009 I'm looking for ideas on the best way to do this. I made a program in PHP that takes in 2 mp4 files, it grabs a screen shot using ffmpeg from 1, and then uploads all 3 files to FTP. However all this happens all at once, with no indication of what is going on. I'm having a lot of trouble figuring out how to do the file upload part with ajax because It has to be sent from the Form so the $_FILES array is set with the right information. So i tried out some iframes and its not going well. My idea so far, which is failing, is to just do the FTP and open a separate window that checks the size of the files and returns them. But its getting very convoluted, and popups suck. Any suggestions on a different approach? Quote Link to comment https://forums.phpfreaks.com/topic/186117-file-upload-progress/ Share on other sites More sharing options...
dreamwest Posted December 23, 2009 Share Posted December 23, 2009 I modified this to upload video files, it works great http://wizecho.com/nav=scripts&s=ajax_image Quote Link to comment https://forums.phpfreaks.com/topic/186117-file-upload-progress/#findComment-982887 Share on other sites More sharing options...
optikalefx Posted December 23, 2009 Author Share Posted December 23, 2009 so your are creating an iframe and re creating the form and submitting that? How can you then access the $_FILES? Care to provide an explanation? Quote Link to comment https://forums.phpfreaks.com/topic/186117-file-upload-progress/#findComment-982889 Share on other sites More sharing options...
dreamwest Posted December 23, 2009 Share Posted December 23, 2009 !Apparently! you cant upload a file by ajax, but the link i gave you uses a javascript iframe. The functionality is identical to ajax Quote Link to comment https://forums.phpfreaks.com/topic/186117-file-upload-progress/#findComment-982894 Share on other sites More sharing options...
optikalefx Posted December 23, 2009 Author Share Posted December 23, 2009 Not quite, I can't get feedback easily. Lets say I use the hidden iframe and it uploads the data. How can i access $FILES['file']['tmp_name'] back in js? Would you say maybe echo out the data you wanted and use iframe.contentDocument.body. whatever and go get the data that way? Quote Link to comment https://forums.phpfreaks.com/topic/186117-file-upload-progress/#findComment-982895 Share on other sites More sharing options...
dreamwest Posted December 23, 2009 Share Posted December 23, 2009 var iframe = document.createElement("iframe"); iframe.setAttribute("id","ajax-temp"); iframe.setAttribute("name","ajax-temp"); iframe.setAttribute("width","0"); iframe.setAttribute("height","0"); iframe.setAttribute("border","0"); iframe.setAttribute("style","width: 0; height: 0; border: none;"); form.parentNode.appendChild(iframe); window.frames['ajax-temp'].name="ajax-temp"; Quote Link to comment https://forums.phpfreaks.com/topic/186117-file-upload-progress/#findComment-982896 Share on other sites More sharing options...
optikalefx Posted December 23, 2009 Author Share Posted December 23, 2009 I think i found a great example http://www.openjs.com/articles/ajax/ajax_file_upload/response_data.php they use the hidden iframe but load the data back in JSON to get easily. I like this way a lot. Quote Link to comment https://forums.phpfreaks.com/topic/186117-file-upload-progress/#findComment-982898 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.