Flash/PHP File Upload Speed Issues
I am trying to write a simple, in-house file delivery application for uploading files for easy download on our client's end. I am us开发者_运维技巧ing Flash with a very basic PHP script receiving the file. So far, this does work.
The problem statement is: using FTP, a 100 MB file will upload in 2-3 minutes. Using my simple Flash uploader and uploading to the same destination, it takes 3-5x longer. Is there any way I can adjust my PHP/Apache settings to improve upload time?
FLA: http://shorttext.com/ku018nj56s
PHP: http://shorttext.com/5thixgjtr
I can't imagine that much of an overhead with a Flash upload component. Can you, as Xeoncross has already recommended, use a different one just to make sure it's nothing program specific? SWFUpload's standard example should be quite easy to set up.
Then, is there any post-processing happening on the server and that might prolong the request? What happens if you let the receiving script die() right away, is the time difference still that much?
How (with what hostname/IP) are you addressing the FTP server, and how does the browser address the script that parses the upload?
I don't think there is anything you can do on the PHP end of things, because the PHP script only comes into play when the file has been fully uploaded. The only thing there could be a web server misconfiguration - Apache or whatever you're running - but this is a very remote possibility.
I would recomend that you try a pre-built flash unloader like the beautiful FancyUpload powered by the mootools Javascript framework. For one, it has been around and open source for much longer so it will be optimized. Second, if it is still slower than FTP (which it will be) then you will know that the fact of the matter is, the overhead of FLASH + Apache + PHP just can't beat the speed of a direct FTP connection.
There are many other uploaders also - from standalone to jQuery!
can you use an XMLHTTPRequest and upload via HTTP?
精彩评论