By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,275 Members | 936 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,275 IT Pros & Developers. It's quick & easy.

File Upload User Control

P: n/a
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
Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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)

"Bijoy Naick" <b_*****@yahoo.ca> wrote in message
news:O4****************@tk2msftngp13.phx.gbl...
| 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
|
|
Nov 18 '05 #2

P: n/a
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

"bruce barker" <no***********@safeco.com> wrote in message
news:OX*************@TK2MSFTNGP12.phx.gbl...
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)

"Bijoy Naick" <b_*****@yahoo.ca> wrote in message
news:O4****************@tk2msftngp13.phx.gbl...
| 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
|
|

Nov 18 '05 #3

P: n/a
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

--

"Bijoy Naick" <b_*****@yahoo.ca> a écrit dans le message de
news:O$**************@TK2MSFTNGP09.phx.gbl...
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

"bruce barker" <no***********@safeco.com> wrote in message
news:OX*************@TK2MSFTNGP12.phx.gbl...
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)

"Bijoy Naick" <b_*****@yahoo.ca> wrote in message
news:O4****************@tk2msftngp13.phx.gbl...
| 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
|
|


Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.