What is the best way to implement a big (1GB or more) file uploader website in PHP or Java?

a 夏天 提交于 2019-12-07 13:49:35

问题


What is the best way to implement a big (1GB or more) file uploader website in PHP or Java? Using the default way of uploading in PHP or Java results in running out of RAM space and slowing the website very dramatically.


回答1:


It would be unwise to open the file on the client side, read its whole content to memory, close it and then start sending the contents, precisely because the contents can exceed the available memory.

One alternative is to open the file, read a chunk of it (remembering where the last chunk ended of course), close the file, upload to the server, and reassemble the file on the server side by appending to previous chunks. This is not a trivial procedure, and should take into consideration things like resource management, IO faults and synchronization, especially when working in parallel with multiple threads.




回答2:


We've been using http://www.javaatwork.com/ftp-java-upload-applet/details.html for uploading very big files to dedicated hosting. It works a treat even with lots of RAW (photo) files.

Only drawback is it's not multi-threading and locks your browser until it's all uploaded.

Still to find another Java uploader as good looking as this (important to us), but there are a few multi-threaded ones out there that look pretty bad :-)




回答3:


I would recommend JumpLoader [google it] , as it offers a lot of useful features. I have integrated it into my opensource CMS project, works just fine (of course, few tunings here and there is needed). Has Javascript interface which you can access with raw Jscript or JQuery [I used latter, coded little plugin for it]. The only drawback would be JumpLoader on applet's forehead :P , which you can have removed for 100 bucks.

Overall, features like multiple uploading, image and document editing in pre-upload, partitioned uploads, transmission integrity check via md5 fingerprinting blah blah blah, are very attractive.



来源:https://stackoverflow.com/questions/2497625/what-is-the-best-way-to-implement-a-big-1gb-or-more-file-uploader-website-in-p

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!