Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can anyone provide a rational explanation as to why a web server must assist in the creation of upload progress bars?

I've been putting together a small personal website in rails and have gotten to the point where I need to be able to upload files. This is an almost trivial task and took no time at all.

What is taking time - and is slowly sapping my sanity - is the task of providing the user with an upload progress bar. I've seen at least a dozen solutions now and they all seem to have one thing in common - they require the installation of a module on the web server.

Given that I have no control over my server that and it seems unlikely that the hosting company will ever undertake to install any such animal, I'm in a bit of a bind. What makes this truly maddening is that involving the server in this process in any way, shape, or form, is absolutely unnecessary.

Think about it: Your browser opens a socket to the remote server and starts sending data. Your browser knows exactly how many bytes are to be sent, and, thanks to the magic of TCP acknowledgments, is also aware of how many bytes have arrived at the server side. So why in the Name of The Flying Spaghetti Monster is there no simple way to present this data to Javascript without futzing around with the blasted server?

like image 663
Sniggerfardimungus Avatar asked Mar 01 '23 16:03

Sniggerfardimungus


1 Answers

The true limitation here are HTML Forms. They were invented over 10 years ago when the upload of larger files seemed completely unfeasible. So they provide you only with one callback: when the entire upload is done (ACTION parameter).

Luckily, there are some free flash based uploaders out there that offer progress bars. Don't worry, most of them will degrade gracefully (providing a simple file upload field if the user has no flash). All options can be controlled via Javascript. And, they don't require any special server-side infrastructure.

Check swfupload.org

like image 167
Franz Avatar answered Apr 28 '23 16:04

Franz