Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

enctype=multipart/form-data

Status
Not open for further replies.

AlbertAguirre

Programmer
Nov 21, 2001
273
US
When using enctype="multipart/form-data" for an ASP file upload, I cannot get a value for another form field with request.form("field1") .

Why?

How can I get the value for another field when using the POST method?
 
Is it allways like this or only when you choose not to upload a file.
I am using a form where uploading a file is optional, when a user does not upload a file I change the forms action and
endcoding
document.forms("editnewfaces").encoding = 'application/x-document.forms("editnewfaces").action = 'edit.asp'
You can allso try to use request("field1") instead of request.form("field1) be sure to have uniqu id's and names for each input field.
 
The Request object doesn't exist when you use the enctype specified; you have to save the file contents first. i.e. if you're using ASPUpload on the page the form submits to:

set upload = server.createobject("persits.upload.1")
upload.savetomemory 'or upload.save(location)

'now you can use the equivalent of the request object for
'all you other fields;

s1 = upload.form("textarea1")
i1 = upload.form("text2")

'and the files are available thus;

file1 = upload.files(1)
'or
file1 = upload.files("file1")


make sense?
 
Yea but isnt the "persist" class a third party module that has to be installed on the host server?
If so, then no good. My host does not support anything like that.
 
how are you uploading your file? and how do you access the file to upload it (ie. what do you call the file input data?)
 
whatever you call:

' Create the FileUploader
Dim Uploader, File
Set Uploader = New FileUploader

' This starts the upload process
Uploader[color].Upload()

is how you access your form input fields:

Uploader.Form("field1")
Uploader.Form("field2")
etc.....
 
sorry, the color tag was supposed to be /color to turn off the color.....

X-)

 
Yea but isnt "Uploader" a third party module that has to be installed on the host?

I dont think uploader is standard ASP.
 
I found a site that has a pure ASP script to upload a file but then other form elements are not available for use.

Big ASP bug. I'm very dissapointed in ASP. I am a newbie with ASP but a seasoned PHP programmer.

I can upload a file with PHP in a few lines of code and have no problem accessing other form elements. They're automatically available.

Man, I'm hurting for getting this out for the client.

On the upside, I can charge alot more for ASP programming. "KaChing!"
 
is this what you found:

FileUploader ASP Library (beta 1.2)
********************************************************
Author: Jacob "Bèézle" Gilley
Co-author: Philippe Collignon (I'm assuming)
Email: avis7@airmail.net
Purpose: To provide a free and easy way to perform file
uploading across the web via Active Server Pages.
********************************************************

if so, you would call the Uploader object the way I mentioned above, then call your form elements with Uploader.Form("field")
 
I have a question for you AlbertAguirre, are you using IIS. If so IIS profides you with a dll called Cpshost.dll.
You should use this DLL.
For more information you should look at the sample codes on msdn.
I use this DLL allways to upload files, it workes ok.
When using asp it is better to white your code in mts com components because this runs a lot faster.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top