473,739 Members | 2,602 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

File uploading from a form with textbox form elements

I've seen plenty of examples of file uploads in ASP.NET when the only
form element is the file input type, but I've not seen a practical
example of a file upload routine running alongside other form
elements, e.g. a text box for a description for example. If the form
is being posted in multipart format then the text coming through will
need to be converted first, won't it?

The other issue is that if the form is posted, and the validation
checks are performed server-side (as they should be, even if you ARE
using client-side checking) won't the form take ages to process due to
the file being transferred in the form data?

I wondered if the webmail style of attachment would be best...where
you popup a window with a form, you attach the file, you upload it,
and then all that appears in the original form is a filename. But
this would mean that the file is already on the server, before you
actually submit the rest of the form contents, so if they then decide
to cancel the form, there'll be an orphaned file.

Is there another way to solve this problem?
Nov 18 '05 #1
2 1917
What I did for a file management sub-system was this:

I have an aspx page that takes (in the query string) the number of files to
upload. I have an <input type=file> for each of these files, as well as
input controls that allow you to fill in several attributes of the file,
such as a description and other attributes relevant to the application.

I furthermore have a web service that stores a link to this file, as well as
an array of names and an equivalent array of values, which form the name
value pairs. I make a call to the web service to store the link to this
document, as well as all of the name value pairs.

The aspx page then simply needs to save the file, and then call the web
service with the location where it saved it and the name value pairs.

Later, when I want to view the files, I can query the web service for all
files with a given name value pair, and it returns that result as a dataset
which I can display on the form.

Doing it this way also enables me to use these attachments from any
application that I want to. All I have to do is give the web service the
name value pair I want to search by, and it returns the list of documents
and their locations, as well as the other friendly descriptions I include.

If you want to display on the fly, and get real data (rather than assumed
data) you could use this solution as well. You can call the web service on
the client side (using MSXML) to get the list of documents that are
relevant, and then you will only see what you have actually finished putting
up there, rather than assuming that calling this second page means the
document is there. When you close the window, you can call a method on the
parent page that re-fetches the list of documents from the server using web
services.
--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Andy Johns" <an*******@ntlw orld.com> wrote in message
news:df******** *************** ***@posting.goo gle.com...
I've seen plenty of examples of file uploads in ASP.NET when the only
form element is the file input type, but I've not seen a practical
example of a file upload routine running alongside other form
elements, e.g. a text box for a description for example. If the form
is being posted in multipart format then the text coming through will
need to be converted first, won't it?

The other issue is that if the form is posted, and the validation
checks are performed server-side (as they should be, even if you ARE
using client-side checking) won't the form take ages to process due to
the file being transferred in the form data?

I wondered if the webmail style of attachment would be best...where
you popup a window with a form, you attach the file, you upload it,
and then all that appears in the original form is a filename. But
this would mean that the file is already on the server, before you
actually submit the rest of the form contents, so if they then decide
to cancel the form, there'll be an orphaned file.

Is there another way to solve this problem?

Nov 18 '05 #2
Your post went unanswered. Have you resolved this issue?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Andy Johns" <an*******@ntlw orld.com> wrote in message
news:df******** *************** ***@posting.goo gle.com...
I've seen plenty of examples of file uploads in ASP.NET when the only
form element is the file input type, but I've not seen a practical
example of a file upload routine running alongside other form
elements, e.g. a text box for a description for example. If the form
is being posted in multipart format then the text coming through will
need to be converted first, won't it?

The other issue is that if the form is posted, and the validation
checks are performed server-side (as they should be, even if you ARE
using client-side checking) won't the form take ages to process due to
the file being transferred in the form data?

I wondered if the webmail style of attachment would be best...where
you popup a window with a form, you attach the file, you upload it,
and then all that appears in the original form is a filename. But
this would mean that the file is already on the server, before you
actually submit the rest of the form contents, so if they then decide
to cancel the form, there'll be an orphaned file.

Is there another way to solve this problem?

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2135
by: IRAS Blues | last post by:
Hi all, I've got a form that consists of a bunch of textboxes and also file upload inputs. For both sets of fields, I need to be able to add in additional elements on the fly. This is done by an "Add Textbox" and "Add Upload Fields" button that I use Javascript to add to the fields. I use client-side Javascript only to add to the fields. The problem comes when I submit the form. When I submit the form, the files uploaded present no...
7
3190
by: pbd22 | last post by:
hi. i am having probs understanding how to grab a file being uploaded from a remote client. i am using hidden input fields for upload such as: <input id="my_file_element" type="file" name="file_1" size=46 /><input type=submit /> so, after adding a few files, the input fields look like this:
4
5489
by: kev | last post by:
Hi folks, I have created a database to store information on equipments. During the first level of registration, there is a form that i need the user to fill up details on the equipment testing. i have done this one.Now what i need is to enable the users to upload files and save it into the corresponding table. Example: 3. A laser inventory form has been completed for each 3b or 4 laser and submitted to the Laser Safety Officer...
7
4600
by: Ed Jay | last post by:
I'm trying to validate a form's file input elements using javascript, but I'm getting nowhere. How can javascript test if a file has been selected using a file form input element? -- Ed Jay (remove 'M' to respond by email)
0
1678
by: sandhyamn | last post by:
hi....i am writing a jsp code for uploading file inside a folder using multipart/form-data.but also i want to write textbox values in to that file, but the textbox values is not coming. ie..textbox content(string) is not taken.if i am using enctype= text/plain,then the textbox valus is coming(valus can displayed in the internet explorer.....but the uploading is not coming...what to do... here any code for write the textbox values into a file...
1
3134
by: sandhyamn | last post by:
hi...i am trying to write a programme for uploading file with jsp using multipart/form data.it's working.....but the problem is i can't write the textbox values into a file....if change the form enctype as text/plain...then the textbox value is taken..but the file uploading is not working...i want a programme like when the file is uploading the textbox is value is write into that file...anyone know how to do this....with javascript and jsp..
15
2494
by: slinky | last post by:
Thanks in advance fo rany help... I have an XML data file (well- formed) that I need to place into my website's app_data folder. I would like to have an .aspx form on my site that simply has two textboxes (corresponding to two XML fields in my file), and a "submit" button that will update the file. Any clues as to the code to use? I'm most familiar with the DataAdapter/DataSet model and using SQLserver files and having an INSERT INTO...
1
5457
by: chrisj | last post by:
I'm using freeASPupload and got some assistance integrating to a Member script. It works successfully. In this modified version there are two groups that use this upload script. Members of one group get automatically re-directed after uploading. However, this member group never gets the benefit of knowing if they've uploaded an incorrect file size or incorrect file extension. Members from the second group do see the "exceeds max file...
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
8792
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
9479
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
9337
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8215
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...
0
6054
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
4570
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...
0
4826
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
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.