如何在上传期间(之前)压缩100MB的文件,以便提高上传速度?
可能的重复:
HTML 压缩文件上传?
我收到客户的投诉,称我的网站需要更多时间来上传100 MB 时间(我知道由于这个大小,肯定会花费更多时间),因此我计划上传文件,以便在上传之前将它们压缩并上传到所需位置,然后解压缩并删除该压缩格式上传的文件。
那么有人可以建议我如何进一步进行吗?
我正在使用 PHP,没有用于上传文件的笨拙代码,它只是具有常用文件上传功能的表单...
编辑我如何在 PHP 中集成 Silverlight 以实现此目的?
请帮忙
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
无法使用纯 html 表单和 PHP 脚本来操作这样的文件。原因之一是,使用浏览器的沙箱,无法访问客户端的文件系统。
您可能想要探索 Java Applet、Silverlight、Flash 类型的解决方案,这是客户端上可以允许访问文件的更丰富的东西。
这是一个使用 Silverlight 的示例
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
为了在上传之前压缩文件,需要在客户端完成。 PHP 在那里没有用,因为 PHP 仅是服务器端的。
选项 1:您要求您的客户上传那些已经压缩的文件(看起来这不是您想要的)。
选项 2:您需要一种通过 javascript 代码在服务器端执行此操作的方法 - 说实话,我怀疑是否有一个简单的解决方案(如果有的话)。也许 zip 数据流可以工作,但为此需要脚本的特殊权限(fe ActiveX) - 如今没有最新的浏览器允许这样做。
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.