Trouble with Request.Form Plus Upload

S

Sean Dotson

I have a form that passes variables to an asp file and then uploads a file.
For some reason the request.form is not getting the info from the form.
It's returning blanks. Any insight would be appreciated....

Here is the asp file

<HTML>
<HEAD>
<TITLE>File Upload Results</TITLE>

<BODY>
<font color=#000000><b>Files Uploaded Status:</b></font><br><br>

<%

Set Upload = server.createObject("Chili.Upload.1")

Upload.AllowOverwrite = True ' Generate unique names
'Upload.SizeLimit = 150000 ' Truncate files above 50KB
On Error Resume Next

MyArray = Split(Upload.SourceFileName, "\")
FName = MyArray(UBound(MyArray))

If Upload.SourceFileExtension = ".pdf" or Upload.SourceFileExtension =
".zip" Then

If Upload.FileSize< 3000000 Then

UpldAllowed=True

Else
UpldAllowed=False

End If

Else

UpldAllowed=False

End If

If Upload.SourceFileExtension = ".gif" or Upload.SourceFileExtension or
".jpg" or Upload.SourceFileExtension or ".png" Then

If Upload.FileSize< 150000 Then

UpldAllowed=True

Else
UpldAllowed=False

End If

Else

UpldAllowed=False

End If

If UpldAllowed=False Then
Response.Write "<font color=red><b>Your file is either of an disallowed
type or is too large. Please <a href=upload.asp>try
again</a></b></font><br>"
Else
Upload.SaveToFile(Server.mapPath("/") & "/" & "/iparttest/upload/" & FName)
Response.Write "<font color=#000000><b>File: </b></font>" &
Upload.SourceFileName & " <font color=#009900><b>--Size:" & Upload.FileSize
&" Bytes -- </b></font> <a target=_blank
href=http://www.sdotson.com/iparttest/upload/" & FName & ">Click to
Test</a><br>"
Response.Write "<br>Copy and paste the following to use your image/file in
the forum:<br><br>"

If Upload.SourceFileExtension = ".pdf" or Upload.SourceFileExtension =
".zip" then
Response.Write "<b><font
color=red>http://www.sdotson.com/iparttest/upload/" & FName & "</b></font>"
Else
Response.Write "<b><font
color=red>http://www.sdotson.com/iparttest/upload/" & FName &
"</b></font>"
End If

End If

Upload.Close

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open
"driver={MySQL};server=localhost;database=username","username","password"

response.write "stuff"
response.write "Description="
response.write (request.form("description"))

set the variables
strImageURL = ""
strFilename = FName
strDescription = request.form("description")
strAuthor = request.form("author")
strCategory = request.form("category")
strIsVerified = "False"
strUpdateDate = Date

sql = "INSERT INTO iparts
(imageurl,filename,description,author,category,isverified,updatedate) VALUES
('" & strImageURL & "','" & strFilename & "','" & strDescription & "','" &
strAuthor & "','" & strCategory & "','" & strIsVerified & "','" &
strUpdateDate & "')"
Conn.Execute(sql)
Conn.Close

%>

</BODY>
</HTML>


_____________________________________________


and here is the form:

<html>


<FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="addnewipart.asp">

<table border="0">
<tr>
<td>iPart to Upload:</td>
<td><INPUT TYPE="FILE" NAME="FILE1"></td>
</tr>
<tr>
<td>Your Name:</td>
<td><input type="text" name="author" size="50"></td>
</tr>
<tr>
<td>Description:</td>
<td><input type="text" name="description" size="50"></td>
</tr>
<tr>
<td>Select a Category - <a href="categoryhelp.html">Help</a></td>
<td> <SELECT NAME="category">
<OPTION value="hydraulics">Hydraulics
<OPTION value="pneumatics">Pneumatics
<OPTION value="fasteners">Fasteners
<OPTION value="hardware">Hardware
<OPTION value="powertransmission">Power Transmission
<OPTION value="fasteners">Fasteners
<OPTION value="fasteners">Fasteners
</SELECT>
</td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit" value="Upload iPart"></td>
</tr>
</table>

</form>

</html>



--
Sean Dotson, PE
Autodesk Inventor Certified Expert
http://www.sdotson.com
http://www.sdotson.com/forums/
Check the Inventor FAQ for most common questions
www.sdotson.com/faq.html
-----------------------------------------------------------------------
 
T

TomB

I'm not familiar with Chili.Upload, but I assume it's the same as other
uploaders.

Once you access the objects form objects, Request.Form will no longer be
available. Take a look at the Chili.Upload docs' It'll likely have it's own
way of accessing the other form items. Something
like....Upload.Form("description") I would suspect.

TomB

Sean Dotson said:
I have a form that passes variables to an asp file and then uploads a file.
For some reason the request.form is not getting the info from the form.
It's returning blanks. Any insight would be appreciated....

Here is the asp file

<HTML>
<HEAD>
<TITLE>File Upload Results</TITLE>

<BODY>
<font color=#000000><b>Files Uploaded Status:</b></font><br><br>

<%

Set Upload = server.createObject("Chili.Upload.1")

Upload.AllowOverwrite = True ' Generate unique names
'Upload.SizeLimit = 150000 ' Truncate files above 50KB
On Error Resume Next

MyArray = Split(Upload.SourceFileName, "\")
FName = MyArray(UBound(MyArray))

If Upload.SourceFileExtension = ".pdf" or Upload.SourceFileExtension =
".zip" Then

If Upload.FileSize< 3000000 Then

UpldAllowed=True

Else
UpldAllowed=False

End If

Else

UpldAllowed=False

End If

If Upload.SourceFileExtension = ".gif" or Upload.SourceFileExtension or
".jpg" or Upload.SourceFileExtension or ".png" Then

If Upload.FileSize< 150000 Then

UpldAllowed=True

Else
UpldAllowed=False

End If

Else

UpldAllowed=False

End If

If UpldAllowed=False Then
Response.Write "<font color=red><b>Your file is either of an disallowed
type or is too large. Please <a href=upload.asp>try
again</a></b></font><br>"
Else
Upload.SaveToFile(Server.mapPath("/") & "/" & "/iparttest/upload/" & FName)
Response.Write "<font color=#000000><b>File: </b></font>" &
Upload.SourceFileName & " <font color=#009900><b>--Size:" & Upload.FileSize
&" Bytes -- </b></font> <a target=_blank
href=http://www.sdotson.com/iparttest/upload/" & FName & ">Click to
Test</a><br>"
Response.Write "<br>Copy and paste the following to use your image/file in
the forum:<br><br>"

If Upload.SourceFileExtension = ".pdf" or Upload.SourceFileExtension =
".zip" then
Response.Write "<b><font
color=red>http://www.sdotson.com/iparttest/upload/" & FName &
Else
Response.Write "<b><font
color=red>http://www.sdotson.com/iparttest/upload/" & FName &
"</b></font>"
End If

End If

Upload.Close

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open
"driver={MySQL};server=localhost;database=username","username","password"

response.write "stuff"
response.write "Description="
response.write (request.form("description"))

set the variables
strImageURL = ""
strFilename = FName
strDescription = request.form("description")
strAuthor = request.form("author")
strCategory = request.form("category")
strIsVerified = "False"
strUpdateDate = Date

sql = "INSERT INTO iparts
(imageurl,filename,description,author,category,isverified,updatedate) VALUES
('" & strImageURL & "','" & strFilename & "','" & strDescription & "','" &
strAuthor & "','" & strCategory & "','" & strIsVerified & "','" &
strUpdateDate & "')"
Conn.Execute(sql)
Conn.Close

%>

</BODY>
</HTML>


_____________________________________________


and here is the form:

<html>


<FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="addnewipart.asp">

<table border="0">
<tr>
<td>iPart to Upload:</td>
<td><INPUT TYPE="FILE" NAME="FILE1"></td>
</tr>
<tr>
<td>Your Name:</td>
<td><input type="text" name="author" size="50"></td>
</tr>
<tr>
<td>Description:</td>
<td><input type="text" name="description" size="50"></td>
</tr>
<tr>
<td>Select a Category - <a href="categoryhelp.html">Help</a></td>
<td> <SELECT NAME="category">
<OPTION value="hydraulics">Hydraulics
<OPTION value="pneumatics">Pneumatics
<OPTION value="fasteners">Fasteners
<OPTION value="hardware">Hardware
<OPTION value="powertransmission">Power Transmission
<OPTION value="fasteners">Fasteners
<OPTION value="fasteners">Fasteners
</SELECT>
</td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit" value="Upload iPart"></td>
</tr>
</table>

</form>

</html>



--
Sean Dotson, PE
Autodesk Inventor Certified Expert
http://www.sdotson.com
http://www.sdotson.com/forums/
Check the Inventor FAQ for most common questions
www.sdotson.com/faq.html
 
S

Sean Dotson

That was it. Thanks. Too bad my host is running Sun ASP v 3.0 which
doesn't support this. Only V4.0 does... At least I'm not crazy...

Thanks again...

--
Sean Dotson, PE
Autodesk Inventor Certified Expert
http://www.sdotson.com
http://www.sdotson.com/forums/
Check the Inventor FAQ for most common questions
www.sdotson.com/faq.html
-----------------------------------------------------------------------
TomB said:
I'm not familiar with Chili.Upload, but I assume it's the same as other
uploaders.

Once you access the objects form objects, Request.Form will no longer be
available. Take a look at the Chili.Upload docs' It'll likely have it's own
way of accessing the other form items. Something
like....Upload.Form("description") I would suspect.

TomB

Sean Dotson said:
I have a form that passes variables to an asp file and then uploads a file.
For some reason the request.form is not getting the info from the form.
It's returning blanks. Any insight would be appreciated....

Here is the asp file

<HTML>
<HEAD>
<TITLE>File Upload Results</TITLE>

<BODY>
<font color=#000000><b>Files Uploaded Status:</b></font><br><br>

<%

Set Upload = server.createObject("Chili.Upload.1")

Upload.AllowOverwrite = True ' Generate unique names
'Upload.SizeLimit = 150000 ' Truncate files above 50KB
On Error Resume Next

MyArray = Split(Upload.SourceFileName, "\")
FName = MyArray(UBound(MyArray))

If Upload.SourceFileExtension = ".pdf" or Upload.SourceFileExtension =
".zip" Then

If Upload.FileSize< 3000000 Then

UpldAllowed=True

Else
UpldAllowed=False

End If

Else

UpldAllowed=False

End If

If Upload.SourceFileExtension = ".gif" or Upload.SourceFileExtension or
".jpg" or Upload.SourceFileExtension or ".png" Then

If Upload.FileSize< 150000 Then

UpldAllowed=True

Else
UpldAllowed=False

End If

Else

UpldAllowed=False

End If

If UpldAllowed=False Then
Response.Write "<font color=red><b>Your file is either of an disallowed
type or is too large. Please <a href=upload.asp>try
again</a></b></font><br>"
Else
Upload.SaveToFile(Server.mapPath("/") & "/" & "/iparttest/upload/" & FName)
Response.Write "<font color=#000000><b>File: </b></font>" &
Upload.SourceFileName & " <font color=#009900><b>--Size:" & Upload.FileSize
&" Bytes -- </b></font> <a target=_blank
href=http://www.sdotson.com/iparttest/upload/" & FName & ">Click to
Test</a><br>"
Response.Write "<br>Copy and paste the following to use your image/file in
the forum:<br><br>"

If Upload.SourceFileExtension = ".pdf" or Upload.SourceFileExtension =
".zip" then
Response.Write "<b><font
color=red>http://www.sdotson.com/iparttest/upload/" & FName &
Else
Response.Write "<b><font
color=red>http://www.sdotson.com/iparttest/upload/" & FName &
"</b></font>"
End If

End If

Upload.Close

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open
"driver={MySQL};server=localhost;database=username","username","password"

response.write "stuff"
response.write "Description="
response.write (request.form("description"))

set the variables
strImageURL = ""
strFilename = FName
strDescription = request.form("description")
strAuthor = request.form("author")
strCategory = request.form("category")
strIsVerified = "False"
strUpdateDate = Date

sql = "INSERT INTO iparts
(imageurl,filename,description,author,category,isverified,updatedate) VALUES
('" & strImageURL & "','" & strFilename & "','" & strDescription & "','" &
strAuthor & "','" & strCategory & "','" & strIsVerified & "','" &
strUpdateDate & "')"
Conn.Execute(sql)
Conn.Close

%>

</BODY>
</HTML>


_____________________________________________


and here is the form:

<html>


<FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="addnewipart.asp">

<table border="0">
<tr>
<td>iPart to Upload:</td>
<td><INPUT TYPE="FILE" NAME="FILE1"></td>
</tr>
<tr>
<td>Your Name:</td>
<td><input type="text" name="author" size="50"></td>
</tr>
<tr>
<td>Description:</td>
<td><input type="text" name="description" size="50"></td>
</tr>
<tr>
<td>Select a Category - <a href="categoryhelp.html">Help</a></td>
<td> <SELECT NAME="category">
<OPTION value="hydraulics">Hydraulics
<OPTION value="pneumatics">Pneumatics
<OPTION value="fasteners">Fasteners
<OPTION value="hardware">Hardware
<OPTION value="powertransmission">Power Transmission
<OPTION value="fasteners">Fasteners
<OPTION value="fasteners">Fasteners
</SELECT>
</td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit" value="Upload iPart"></td>
</tr>
</table>

</form>

</html>



--
Sean Dotson, PE
Autodesk Inventor Certified Expert
http://www.sdotson.com
http://www.sdotson.com/forums/
Check the Inventor FAQ for most common questions
www.sdotson.com/faq.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top