开发者

Compress file before upload via http

Is it possible to compress data being sent from the client's browser (a file upload) to the server?

Flash, silverlight and o开发者_Python百科ther technology is ok!


Browsers never compress uploaded data because they have no way of knowing whether the server supports it.

Downloaded content can be compressed because the Accept-Encoding request header allows the browser to indicate to the server that it supports compressed content. Unfortunately, there's no equivalent protocol that works the other way and allows the server to indicate to the browser that it supports compression.

If you have control over the server and client (e.g. using silverlight, flash) then you could make use of compressed request bodies.


For Silverlight there is a library called Xceed which amongst other things "Lets you compress data as it is being uploaded.", it is not free though. I believe that this can only be done via a technology such as Flash or Silverlight and not natively on the browser.

I disagree with the above poster about browsers doing this automatically and I believe this only happens with standard HTML/CSS/Text files and only if the server and browser both have compression enabled (gzip, deflate).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜