472,328 Members | 1,047 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 software developers and data experts.

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 1801
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*******@ntlworld.com> wrote in message
news:df**************************@posting.google.c om...
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*******@ntlworld.com> wrote in message
news:df**************************@posting.google.c om...
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
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...
7
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: ...
4
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...
7
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...
0
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,...
1
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...
15
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...
1
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...
7
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...
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

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.