Link to home
Start Free TrialLog in
Avatar of Jaymol
Jaymol

asked on

File upload - button only, with postback????

Hi.

I'm creating a page where users can upload files using the .Net 2 FileUpload component (hopefully!!)

I understand that this is similar to the input type of 'file', and that you're supposed to select a file, and then have a seperate button for submitting and therefore uploading, but I find this particularly ugly.

I simply want a browse button that pops up the FileUpload's 'browse' dialog, and then uploads the file if the user clicks 'okay', therefore allowing me to handle the server side stuff and save the file etc..

The closest I have got to this is a button that clicks a 'hidden' FileUpload control, and then does a postback via JavaScript, but this does not work - you get an 'access denied' error, caused by the FileUpload not having a file.

If you get what I'm asking for, can someone please let me know if this is possible, without having to code the upload myself.  (I've done this before when coding with pure ASP, not .Net, and would rather not have to do it, especially since the FileUpload component already does most of what I need!!!)

Thanks in advance,

John.
Avatar of zkeown
zkeown
Flag of United States of America image

I've not used this custom control, but have heard good things.  It's a customized FileUpload with an AutoPostBack event, which should handle what you're after.

http://www.metabuilders.com/Tools/FileUpload.aspx
Avatar of Jaymol
Jaymol

ASKER

Thanks, but I don't want to use 3rd party controls - I want this coded myself.

Incidentally, on a funny note, the link you gave me points to the controls that I'm currently replacing!!!

Thanks again.
ASKER CERTIFIED SOLUTION
Avatar of Jaymol
Jaymol

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial