Zend_File_Transfer and Zend_ProgressBar
in order to monitor the upload of large video files I'm using the progress bar as shown in the demo that is shipped with the framework. The upload is working fine and the progress is shown correctly.
However, since the form is targeting a hidden iframe, the server response to the initial post request is sent to that hidden iframe.
So here are my questions:
- Why do I need to target an iframe in the first place?
- How do I display error messages (invalid post requests) or redirects (valid post requests) on the original page, not on the (hidden) iframe?
I know there are various third party solutions to file-uplo开发者_运维百科ads out there (uploadify, SWFUpload, etc.), but I wanted to give the zend framework approach a try.
Help is greatly appreciated!
So long,
blaxxAn upload is a page request. As any new page request, uploads to stop any active javascript running in the current page. As you want to keep your javascript running you delegate the upload page request to an iframe - which then doesn't stop the javascript in you main page. So if you don't target an iframe - the upload request would first stop all javascript running in your page and then do the upload.
Actually the form helper just hides the new page request in an iframe for that.
To be able to show custom responses and stuff you can either modify the evalProgress -function or subscribe to the iframe's onload event (from a javascript pov a iframe is pretty much the same as or html/body tag). For example you could subscribe to the onload event and then read the iframes content by javascript and evaluate it (ajax requests for foreign servers work that way too btw).
精彩评论