Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Trouble with Request.Form Plus Upload

Reply
Thread Tools

Trouble with Request.Form Plus Upload

 
 
Sean Dotson
Guest
Posts: n/a
 
      05-05-2004
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
-----------------------------------------------------------------------


 
Reply With Quote
 
 
 
 
TomB
Guest
Posts: n/a
 
      05-05-2004
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:(E-Mail Removed)...
> 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
> -----------------------------------------------------------------------
>
>



 
Reply With Quote
 
 
 
 
Sean Dotson
Guest
Posts: n/a
 
      05-05-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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:(E-Mail Removed)...
> > 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
> > -----------------------------------------------------------------------
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
c plus plus code comparator furqan shaikh C++ 6 11-12-2008 06:14 AM
Invoking c function in a c plus plus function... Rahul C++ 9 03-25-2008 05:24 PM
C plus plus vs C Sharp The LoxFather C Programming 23 08-14-2003 03:51 AM
C plus plus vs C Sharp The LoxFather C++ 23 08-14-2003 03:51 AM



Advertisments