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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With