Awesome jQuery File Upload
blueimp.github.com
blueimp.github.com
No fault of the engineer: THIS NEEDS TO GET BUILT INTO THE DAMN BROWSER.
Yes. Upload. With an actual progress bar. Built into the app you sit in all day. Imagine that.
Sending messages to a PHP server script so you can have the server tell you how many bytes were sent? Even the dumbest terminals knew how to show a bytes uploaded count with XMODEM in 1977.
Google Music installs a friggin client app to hash and upload your songs. DropBox still can't get drag and drop working and STILL limits files to 150MB if you upload via HTTP.
This is such a basic scenario I simply don't understand why it hasn't been solved. And don't even get me started on the Upload Straight to Amazon S3 via Flash/Silverlight doodads. Nobody can seem to get those working reliably either.
Edit: yeah, could probably be done with a java applet, possibly hidden. Not sure if it would get all the benefits you're looking for, but I do know the FTP protocol gives upload progress (at least).
(See also, editing rich text.)
I've spent months on this problem. The challenge is that the behavior you want (text ranges) does not map well onto the DOM (trees). This takes some thought but isn't THAT bad. Browser bugs also play a role since the code paths aren't used that often but the main reason is the w3c Range API is the worst API I am aware of in any language and everything you could use to replace it is not cross browser.
We have > 4GB uploads to S3 working reliably (original video files for encoding are quite large so long uploads are not an edge case for us). You can multi-select files, and the user sees upload progress percentages on all of them. We're using Silverlight (with less reliable Flash and HTML5 fallbacks).
Psst.. XMLHttpRequestUpload
† It's the downloading with Ajax that is the problem. There's no way to tell how big the file is.
var xhr = $.ajax({ type: "HEAD", ...
xhr.getResponseHeader('Content-Length')
I wound up using Silverlight. Sigh.I don't understand why this isn't solved, but even more so I don't understand why most people seem to be perfectly happy with the current state of things. In fact, I get the impressions most web developers like this. They like writing scripts to solve trivial problems or finding obscure scripts that do it for them. Makes them feel helpful and important, or something. Me? Makes me angry. This should have been conclusively solved a decade ago.
I'm seriously considering writing my own toy browser. Not that someone will use it, but at least I will be able to tell for sure how difficult is it to solve all these trivial problems.
I highly recommend it. We made it our default uploader, replacing both a java applet and Yui uploader. the drag and drop is awesome, as are the hooks for custom ui, pre-flighting, and error handling.
Alan
* Your response must be at least 512 characters (we added white space padding to our JSON response). This is because IE overrides any 400-500 response with its friendly error messages unless you provide at least 512 characters of data. If you don't do this you'll get a cross site scripting error (because you'd be trying to read in the friendly error page, which is not on your domain)
* You'll need to add the response code in your response text because there's no way (please correct me if I'm wrong) to read the http status of a loaded page's headers in an iframe. You'll then need to modify the iframe-transport to read in the status code from your response text and make the appropriate ajax calls in jQuery.
This is obviously quite a bit hacky (and took me forever to figure out). Let me know if anyone else has any insight into this. I'll probably write this up in more detail in a blog post to come.
On the first we used it to replace a flash based solution that was causing problems with the Flash 10 release. I had to hack the plugin to handle a case that it wasn't specifically designed to handle in the first one (probably just due to my unfamiliarity with the plugin at that point) and in the second one I had to add all sorts of advanced functionality to an older version of the plugin (v4), which we had used in building the app, initially.
My advice is to make sure to start small (single file upload) and build up, instead of just trying to port your solution over, you might also run into issues with Firefox 3 and all of IE if you go too custom, so keep that in mind.
It really is a great piece of software, detailed version specific documentation and FAQs, and the author blueimp is most helpful and quick in responding to issues on github. I remember a thread with him that went on for days, delving into specific lines of code and why they were written that way and at every point I kept thinking
"Okay, he's either going to cuss me out or stop responding at this point"
but he just kept helping out. Truly exemplary attitude, I can only hope to have half that much patience.
I ended up taking the brutally simple approach of "upload a zip file" to one client, which worked at least!
edit: forgot we made a screencast last month http://blog.picplum.com/how-to-send-photo-prints-60-seconds/
I've only used this one (jquery file upload) and it has been great to work with.
Thanks for sharing this.
I almost didn't use the plugin until I found out I didn't need bootstrap and an entire user interface.
Nevertheless, this is the sleekest approach to file upload I've seen.