views:

768

answers:

4

Basically, something better than this:

<input type="file" name="myfile" size="50">

First of all, the "browse" button looks different on every browser. Unlike the "submit" button on a form, you have to come up with some hack-y way to style it.

Secondly, there's no progress indicator showing you how much of the file has uploaded. You usually have to implement some kind of client-side way to disable multiple submits (e.g. change the submit button to a disabled button showing "Form submitting... please wait.") or flash a giant warning "DO NOT SUBMIT TWICE."

Are there any good non-Flash or silly Java applet solutions to this?

Yaakov: That product looks to be exactly what I'm looking for, but the cost is $1000 and its specifically for ASP.NET. Hasn't the open source community done any better? ;-)

A: 

It is true, the file upload control is definitely behind the times. Hopefully this will be addressed in a future asp.net version.

Though it costs some money, I have found the Telerik upload control to have all of the functionality that you are looking for, including styling and progress updates (it also optimizes memory for large uploads).

Yaakov Ellis
+7  A: 

File upload boxes is where we're currently at if you don't want to involve other technologies like Flash, Java or ActiveX.

With plain HTML you are pretty much limited to the experience you've described (no progress bar, double submits, etc). If you are willing to use some javascript, you can solve some of the problems by giving feedback that the upload is in progress and even showing the upload progress (it is a hack because you shouldn't have to do a full round-trip to the server and back, but at least it works).

If you are willing to use Flash (which is available pretty much anywhere and on many platforms), you can overcome pretty much all of these problems. A quick googling turned up two such components, both of them free and open source. I never used any of them, but they look good. BTW, Flash isn't without its problems either, for example when using the multi-file uploader for slide share, the browser kept constantly crashing on me :-(

Probably the best solution currently is to detect dynamically if the user has Flash, and if it's the case, give her the flash version of the uploader, while still making it possible to choose the basic HTML one.

HTH

Cd-MaN
+1  A: 

You could have a look at the Fancy Upload script. Though it uses flash it still looks great.

DylanJ
+1  A: 

The problem here is that the browsers specifically work to block anything that changes the basic file upload input control. You can't change it with javascript for instance.

The reason is security - if I could script it I could build a page that when you visited it sent me various files from your hard disk. Not nice.

There are various workarounds at the moment, but they're different between IE and FX (I don't know about Safari, Opera, etc).

Look at what http://www.gmail.com does in IE and FX when you attach something to an e-mail.

I want to see that rubbish "Browse" button - it tells me that I'm not letting anything unexpected in.

Keith