Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 other technology is ok!

like image 808
bleevo Avatar asked Dec 08 '09 06:12

bleevo


Video Answer


2 Answers

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.

like image 199
HttpWatchSupport Avatar answered Oct 01 '22 16:10

HttpWatchSupport


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).

like image 27
row1 Avatar answered Oct 01 '22 14:10

row1