Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP General (http://www.velocityreviews.com/forums/f65-asp-general.html)
-   -   Trouble with Request.Form Plus Upload (http://www.velocityreviews.com/forums/t794304-trouble-with-request-form-plus-upload.html)

Sean Dotson 05-05-2004 03:37 PM

Trouble with Request.Form Plus Upload
 
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
-----------------------------------------------------------------------



TomB 05-05-2004 04:07 PM

Re: Trouble with Request.Form Plus Upload
 
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:eSxsHcrMEHA.1608@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
> -----------------------------------------------------------------------
>
>




Sean Dotson 05-05-2004 05:42 PM

Re: Trouble with Request.Form Plus Upload
 
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" <shuckle@hotmailXXX.com> wrote in message
news:u81jVsrMEHA.2628@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:eSxsHcrMEHA.1608@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
> > -----------------------------------------------------------------------
> >
> >

>
>





All times are GMT. The time now is 12:51 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.