File Upload User Control

B

Bijoy Naick

I've written a simple file upload user control in VB .NET. It comprises of
an InputFile HTML Server Control, an Upload button and a message label.

User clicks on the Browse button of the InputFile control, selects a file,
then clicks on the Upload button. The file is saved to a folder on the
server and the message label displays the appropriate msg. The user control
also has a SetFilePath method.. This is used by the page which includes the
control to specify where on the server the file should be written to.

My problem is this :

Lets say I have 2 instances of the user control on a aspx page, along with
some other fields. The form on this page has its own "Submit" button. I
click on the browse button on Control 1 and select a file. I then click the
Browse button on Control 2 and select another file. I also fill out the
other form elements. Now when I click the Upload button on Control 1, the
file gets saved as expected.. The data I entered into the other form
elements stays as is - also expected. But, the file selected on the 2nd
Control is now blank.

Dunno why this happens? Any ideas? I want the selection on the other control
to stay as is so that I can click on Upload and save the 2nd file as well.

Help appreciated..

Bijoy
 
B

bruce barker

when the user clicks submit, both files are uploaded. you are just ignoring
the second one. after the upload, the page is redisplayed, in which case the
browser clears the upload input box (not allowed to set by server).

-- bruce (sqlwork.com)

| I've written a simple file upload user control in VB .NET. It comprises of
| an InputFile HTML Server Control, an Upload button and a message label.
|
| User clicks on the Browse button of the InputFile control, selects a file,
| then clicks on the Upload button. The file is saved to a folder on the
| server and the message label displays the appropriate msg. The user
control
| also has a SetFilePath method.. This is used by the page which includes
the
| control to specify where on the server the file should be written to.
|
| My problem is this :
|
| Lets say I have 2 instances of the user control on a aspx page, along with
| some other fields. The form on this page has its own "Submit" button. I
| click on the browse button on Control 1 and select a file. I then click
the
| Browse button on Control 2 and select another file. I also fill out the
| other form elements. Now when I click the Upload button on Control 1, the
| file gets saved as expected.. The data I entered into the other form
| elements stays as is - also expected. But, the file selected on the 2nd
| Control is now blank.
|
| Dunno why this happens? Any ideas? I want the selection on the other
control
| to stay as is so that I can click on Upload and save the 2nd file as well.
|
| Help appreciated..
|
| Bijoy
|
|
 
B

Bijoy Naick

Bruce,

I think u misunderstood.. Problem occurs when the UPLOAD button of one of
the controls is clicked, NOT the SUBMIT button of the overall form.

Bijoy
 
P

Patrice

Not clear. What does your "upload" button ? If it uploads the file it is
actually technically a submit button causing the file to be uploaded and the
other field to be redisplayed blank.

I don't see why you would want a distinct upload button for each file. Have
a single submit (or whatever it is called) button for the whole form.

Patrice

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,094
Latest member
IchNar

Latest Threads

Top