View Full Version : upload file from asp
I have created a form in which with other form elements there is one input type file also there.
For uploading that file from asp I am giving ENCTYPE="multipart/form-data" in form tag now the file get upload but after submiting the all the other values are not getting. I can not give two seperate forms.
intothemiddle
08-03-2003, 02:50 PM
Hi ebco,
This may be of some use to you:
http://www.asp101.com/resources/saupload.asp
Else it may help if you give some specifics of what you're trying to get and how you're trying to accept it on the 2nd part of the process.
Hope that helps.
Intothemiddle
miranda
08-04-2003, 05:36 PM
try Upload.Form("form_element") on all of the items in your form instead of Request.Form("form_element")
Bullschmidt
08-05-2003, 04:58 AM
First let's deal with the timeout issue which can be a problem if a user is uploading a fairly large file (although perhaps you don't want the timeout increased too much because you DON'T want a user uploading a large file).
For pure ASP (i.e. non component) solutions (and I believe this would be true for component solutions too) can increase the timeout for the page:
' Script timeout in seconds for this page.
' (60 x 60 = 1 hour.)
Server.ScriptTimeout = 60 * 60
Also the Anonymous Internet user needs Change permission on the folder that a file is going to be uploaded to and actually Full Access might be better if you are later going to use the FileSystemObject to delete a file.
Here is a resource for letting the user upload a file which is something that was unfortunately not built into ASP:
ASP File Upload Using VBScript by John R. Lewis - 7/10/2000
http://www.aspzone.com/articles/john/aspUpload
And whatever file uploading solution you use, on the page in question you will no longer be able to refer to regular form fields with Request.Form("MyField"). Instead there will be some kind of proprietary way to refer to the fields.
It is nor the problem of script timeout & nor folder rights.
If i removed ENCTYPE="multipart/form-data" from the form tag it gives me value on submit in request.form("name") whith ENCTYPE="multipart/form-data" it gives me blank data.
Spudhead
08-07-2003, 01:04 PM
Read miranda's post. It's because posting the form as binary data removes any access ASP has to the request.form object.
Most [all?] ASP ulpoad components compensate for this by giving the upload object a form collection, through which you can access miscellaneous posted form elements.
Bullschmidt
08-07-2003, 02:15 PM
And whatever file uploading solution you use, on the page in question you will no longer be able to refer to regular form fields with Request.Form("MyField"). Instead there will be some kind of proprietary way to refer to the fields.
I think there is nothing called as Upload.Form in asp?
fractalvibes
08-11-2003, 07:52 AM
Quite true. Your upload component whatever it might be is doing a binary read of the raw form post - really nasty-looking stuff. Thereafter you cannot directly refer to request.Form("somefield").
As was said earlier, most of these components do make the collection of form fields available to you, but you have to read the docs for that specific component.
Something like
Set objUpload = Server.CreateObject("SomeUploadComponent")
objUpload.Upload
arg1 = objUpload.Fields("somefield")
ect.
syntax may be a bit dodgy here, coming off of several hours of PHP coding where it can be done natively without all this hoo-haa.. all I could do not to use semi-colons!
:0
miranda
08-11-2003, 08:13 PM
Ebco is right Upload.form("fieldName") is not a part of ASP. BY using <FORM METHOD="POST" ACTION="PROCESS.ASP" ENCTYPE="MULTIPART/FORM-DATA">
This attribute changes the encoding type (ENCTYPE) of the form for efficiency of transferring large amounts of data. However, this encoding type is not understood by ASP's Request.Form method. It is unable to separate the file information from the other form data.
If you are using upload componts like Persits ASPUpload, Dimacs W3 upload, SAFileup, then you would do so like this
Dim upload
Set Upload = Server.CreateObject("uploadComponent")
Upload.form("fieldName")
If you are still confused look at the documentation provided by the upload component on their website
whammy
08-12-2003, 01:20 AM
I know what you mean, fractalvibes... I constantly catch myself adding semicolons to the end of vbscript statements. :eek:
fractalvibes
08-13-2003, 05:02 AM
Yep, the contect switch is sometimes a little slow at the end/beginning of the day.
'response.write' generates some nasty parse errors in php....
as does 'echo' in asp!
Good to be multi-lingual, though!
whammy
08-13-2003, 05:37 AM
lol ;)
Ok Thanks.
But all that componts are chargable......
Is there any other option to solve this problem.
whammy
08-14-2003, 07:47 PM
Try here:
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=4&txtCodeId=6447
fractalvibes
08-14-2003, 11:53 PM
Here are some other options:
http://www.aspfaqs.com/aspfaqs/ShowCategory.asp?CatID=19
ya it helped me lot fractalvibes.
Thanks to all.
Bullschmidt
07-22-2005, 06:28 PM
Updated (corrected) link to my earlier post:
ASP File Upload Using VBScript by John R. Lewis - 7/10/2000
http://aspzone.com/articles/160.aspx
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.