Uploading files like Gmail client

In Web development on June 17, 2008 by Matt Giuca

One of those tutorials I wish I had written, since I already “reverse engineered” it (if I can call it that) on my own and coded up my own Ajax-style upload box for a web app I worked on last summer.

But someone beat me to it: Sajith.M.R explains how to upload files like the Gmail client. The first article on Gmail was very cool as well (link from there).

A small correction: “Ajax does not support multipart/form-data posts” – well you can certainly make it support such posts! The real problem here is that JavaScript provides no way to access the contents of, or dynamically send, a file upload box. Hence this trick is a nifty workaround.

In my experience, the biggest pain using this method is actually debugging it. If you’re used to using Firebug (for example) to review XMLHttpRequests, well you don’t get none of that here. (Though Wireshark should still be a handy debugging tool in this case).

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: