HTML Compress File Upload?

2019-01-12 03:35发布

is there any way you can get a browser to compress a file before uploading it?

ie from an <input type="file">

Thanks, Jamie

3条回答
Melony?
2楼-- · 2019-01-12 04:02

While you can't compress the file before transfer. If the most important thing is that it resides on your server compressed, and is later downloaded compressed. You can easily set up some server side code to do the work after the file is received. As a redundant note, this will do nothing to improve upload speed, as the file is uploaded uncompressed, and then compressed server side.

查看更多
\"骚年 ilove
3楼-- · 2019-01-12 04:03

Without using Flash, Java, Silverlight, or similar plug-ins, the browser doesn't compress the files it uploads. It's the server that can send compressed data, if it has been set to do so.

To give a complete answer, I should say there are implementations of GZip made in JavaScript; considering that it is made natively in JavaScript, it is not a practical solution, and should be considered only in particular cases.

查看更多
Fickle 薄情
4楼-- · 2019-01-12 04:20

Not using pure HTTP. You could do it using silverlight or flash, though.

查看更多
登录 后发表回答