473,714 Members | 2,527 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

File Upload User Control

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
3 2845
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******** ********@tk2msf tngp13.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
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******** *****@TK2MSFTNG P12.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******** ********@tk2msf tngp13.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
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$******** ******@TK2MSFTN GP09.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******** *****@TK2MSFTNG P12.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******** ********@tk2msf tngp13.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2818
by: Jonatan | last post by:
Hi all, I'm trying to upload files doing something like gmail. I almost got it but I have a problem when I post the form. Basicaly, I am doing the following. When the user presses the link I create a input type="file". Then I fire the click event of the control and the open file dialog appears. The user selects a file and then the onpropertychange of the control
2
2574
by: mano kumar | last post by:
hello, is there a way i can control what user upload to the webserver? i've created a upload feature and i dont know howto control what the user uploads. i want to allow my user to only upload .doc files. any help i greatly appriciated... yours truly Mano Kumar
4
2285
by: Amar | last post by:
I am trying to upload a file to the webserver through my asp.net application. The file upload works fine for files below 50 MB size because i have set the maxrequestlength property of the <httpruntime> in the machine.config file as 51200KB. whenever the user tries to upload a file which is more than 51200KB then, a blank page with DNS error is shown as soon as the user hits the submit button. I want to be able to display an error message...
3
2283
by: | last post by:
Thanks Richard and Shan, I am using the HtmlInputFile control.But Shan where exactly do you want me to put in your code? becoz,after the user selects a file to upload and hits Submit, then the flow of the code does not go into the OnClick() event of the submit button, if the filesize is > 50 Mb.I checked this by setting a breakpoint on the first line of the OnClick event. The aspx page just shows a DNS error page. Is there a way, that i...
1
2552
by: TK | last post by:
I have a file upload control to allow a user to select/upload a file to the server. They need to upload x number of files in one shot because they have to confirm that they are uploading x number files for processing. So I do not want the files to be uploaded until the user presses a submit button verifying that they want to submit x number of files for processig (processing refers to me doing something to the files once uploaded). Catch...
13
4312
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming that this is suppossed to end up as a component for others to use, and therefore I do NOT have access to their global.cs::Session_End() how do I cleanup files that were uploaded -- but obviously left stranded when the users aborted/gave up writting...
2
1848
by: Tim::.. | last post by:
Can someone please tell me why I keep getting an error saying the page cannot be displayed in my ASP.NET app. If I upload a file that is under approx 3mb then it works file but as soon as I try to upload a larger file I get Page Cannot be displayed error... I'm uploading the file as binary into and SQL 2000 Database! Any advice would be appritiated!
12
2489
by: GuangXiN | last post by:
I want the file upload element disappear, instead of it, I place a text box and a button with my own css defination. but it doesn't work on IE7. What should I do now? <form action="upload.php" method="POST" enctype="multipart/form-data"> <p> <span>Select photo:</span> <input type="file" name="photo" style="display:none;"> <input type="text" name="photoUrl" class="s1" /> <input type="button" class="s2"...
7
7153
Curtis Rutland
by: Curtis Rutland | last post by:
Building A Silverlight (2.0) Multi-File Uploader All source code is C#. VB.NET source is coming soon. Note: This project requires Visual Studio 2008 SP1 or Visual Web Developer 2008 SP1 and Silverlight 2.0. To get these tools please visit this page Get Started : The Official Microsoft Silverlight Site and follow Step 1. Occasionally you find the need to have users upload multiple files at once. You could use multiple FileUpload...
0
8796
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8704
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9307
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9009
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7946
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6627
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5943
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4462
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2105
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.