问题
Possible Duplicate:
HTML Compress File Upload?
I have complains from client that my website is taking more time to upload the 100 MB time (I know it bound to take more time because of this size), hence I am planning to upload files such that they get zipped before upload and gets uploaded to desired location and then gets unzipped along with the deletion of that zipped format uploaded file.
So can anyone suggest me how to proceed further?
I am using PHP, there is no clumsy code for uploading file its just a form with usual file upload functionalty...
EDIT How could I Integrate Silverlight for this purpose in PHP?
please help
回答1:
There's no way to manipulate the file like this with a plain html form and PHP script. For one reason, with the browser's sandbox, there's no access to the client's filesystem.
You would probably want to explore a Java Applet, Silverlight, Flash type solution, something richer on the client that can be allowed access to the file.
Here's one example using Silverlight
回答2:
In order to zip the file before upload it needs to be done on client side. PHP is of no use there because PHP is server-side only.
Option 1: You ask your clients to upload those files already zipped (looks like thats not what you want).
Option 2: You need a way to do it serverside by javascript code - to be honest i doubt that there is an easy solution for that if at all. Maybe a zip data stream could work, but for that special permissions for the script (f.e. ActiveX) are required - and today no upto date browser will allow that.
来源:https://stackoverflow.com/questions/3155587/how-to-zip-100-mb-files-during-before-upload-so-that-upload-speed-can-be-incre