By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,630 Members | 1,166 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,630 IT Pros & Developers. It's quick & easy.

Trouble with Request.Form Plus Upload

P: n/a
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>[img]http://www.sdotson.com/iparttest/upload/" & FName &
"[/img]</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,isv erified,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
-----------------------------------------------------------------------
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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" <sean dotson at comcast dot net> wrote in message
news:eS**************@TK2MSFTNGP12.phx.gbl...
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>[img]http://www.sdotson.com/iparttest/upload/" & FName &
"[/img]</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,isv erified,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
-----------------------------------------------------------------------

Jul 19 '05 #2

P: n/a
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" <sh*****@hotmailXXX.com> wrote in message
news:u8**************@TK2MSFTNGP12.phx.gbl...
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" <sean dotson at comcast dot net> wrote in message
news:eS**************@TK2MSFTNGP12.phx.gbl...
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>[img]http://www.sdotson.com/iparttest/upload/" & FName &
"[/img]</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,isv erified,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
-----------------------------------------------------------------------


Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.