473,722 Members | 2,161 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.createOb ject("Chili.Upl oad.1")

Upload.AllowOve rwrite = True ' Generate unique names
'Upload.SizeLim it = 150000 ' Truncate files above 50KB
On Error Resume Next

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

If Upload.SourceFi leExtension = ".pdf" or Upload.SourceFi leExtension =
".zip" Then

If Upload.FileSize < 3000000 Then

UpldAllowed=Tru e

Else
UpldAllowed=Fal se

End If

Else

UpldAllowed=Fal se

End If

If Upload.SourceFi leExtension = ".gif" or Upload.SourceFi leExtension or
".jpg" or Upload.SourceFi leExtension or ".png" Then

If Upload.FileSize < 150000 Then

UpldAllowed=Tru e

Else
UpldAllowed=Fal se

End If

Else

UpldAllowed=Fal se

End If

If UpldAllowed=Fal se Then
Response.Write "<font color=red><b>Yo ur file is either of an disallowed
type or is too large. Please <a href=upload.asp >try
again</a></b></font><br>"
Else
Upload.SaveToFi le(Server.mapPa th("/") & "/" & "/iparttest/upload/" & FName)
Response.Write "<font color=#000000>< b>File: </b></font>" &
Upload.SourceFi leName & " <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.SourceFi leExtension = ".pdf" or Upload.SourceFi leExtension =
".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.CreateOb ject("ADODB.Con nection")
Conn.Open
"driver={MySQL} ;server=localho st;database=use rname","usernam e","password "

response.write "stuff"
response.write "Descriptio n="
response.write (request.form(" description"))

set the variables
strImageURL = ""
strFilename = FName
strDescription = request.form("d escription")
strAuthor = request.form("a uthor")
strCategory = request.form("c ategory")
strIsVerified = "False"
strUpdateDate = Date

sql = "INSERT INTO iparts
(imageurl,filen ame,description ,author,categor y,isverified,up datedate) VALUES
('" & strImageURL & "','" & strFilename & "','" & strDescription & "','" &
strAuthor & "','" & strCategory & "','" & strIsVerified & "','" &
strUpdateDate & "')"
Conn.Execute(sq l)
Conn.Close

%>

</BODY>
</HTML>
_______________ _______________ _______________
and here is the form:

<html>
<FORM METHOD="POST" ENCTYPE="multip art/form-data" ACTION="addnewi part.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="descripti on" size="50"></td>
</tr>
<tr>
<td>Select a Category - <a href="categoryh elp.html">Help</a></td>
<td> <SELECT NAME="category" >
<OPTION value="hydrauli cs">Hydraulic s
<OPTION value="pneumati cs">Pneumatic s
<OPTION value="fastener s">Fasteners
<OPTION value="hardware ">Hardware
<OPTION value="powertra nsmission">Powe r Transmission
<OPTION value="fastener s">Fasteners
<OPTION value="fastener s">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
2 2456
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("descripti on") I would suspect.

TomB

"Sean Dotson" <sean dotson at comcast dot net> wrote in message
news:eS******** ******@TK2MSFTN GP12.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.createOb ject("Chili.Upl oad.1")

Upload.AllowOve rwrite = True ' Generate unique names
'Upload.SizeLim it = 150000 ' Truncate files above 50KB
On Error Resume Next

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

If Upload.SourceFi leExtension = ".pdf" or Upload.SourceFi leExtension =
".zip" Then

If Upload.FileSize < 3000000 Then

UpldAllowed=Tru e

Else
UpldAllowed=Fal se

End If

Else

UpldAllowed=Fal se

End If

If Upload.SourceFi leExtension = ".gif" or Upload.SourceFi leExtension or
".jpg" or Upload.SourceFi leExtension or ".png" Then

If Upload.FileSize < 150000 Then

UpldAllowed=Tru e

Else
UpldAllowed=Fal se

End If

Else

UpldAllowed=Fal se

End If

If UpldAllowed=Fal se Then
Response.Write "<font color=red><b>Yo ur file is either of an disallowed
type or is too large. Please <a href=upload.asp >try
again</a></b></font><br>"
Else
Upload.SaveToFi le(Server.mapPa th("/") & "/" & "/iparttest/upload/" & FName) Response.Write "<font color=#000000>< b>File: </b></font>" &
Upload.SourceFi leName & " <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.SourceFi leExtension = ".pdf" or Upload.SourceFi leExtension =
".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.CreateOb ject("ADODB.Con nection")
Conn.Open
"driver={MySQL} ;server=localho st;database=use rname","usernam e","password "

response.write "stuff"
response.write "Descriptio n="
response.write (request.form(" description"))

set the variables
strImageURL = ""
strFilename = FName
strDescription = request.form("d escription")
strAuthor = request.form("a uthor")
strCategory = request.form("c ategory")
strIsVerified = "False"
strUpdateDate = Date

sql = "INSERT INTO iparts
(imageurl,filen ame,description ,author,categor y,isverified,up datedate) VALUES ('" & strImageURL & "','" & strFilename & "','" & strDescription & "','" &
strAuthor & "','" & strCategory & "','" & strIsVerified & "','" &
strUpdateDate & "')"
Conn.Execute(sq l)
Conn.Close

%>

</BODY>
</HTML>
_______________ _______________ _______________
and here is the form:

<html>
<FORM METHOD="POST" ENCTYPE="multip art/form-data" ACTION="addnewi part.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="descripti on" size="50"></td>
</tr>
<tr>
<td>Select a Category - <a href="categoryh elp.html">Help</a></td>
<td> <SELECT NAME="category" >
<OPTION value="hydrauli cs">Hydraulic s
<OPTION value="pneumati cs">Pneumatic s
<OPTION value="fastener s">Fasteners
<OPTION value="hardware ">Hardware
<OPTION value="powertra nsmission">Powe r Transmission
<OPTION value="fastener s">Fasteners
<OPTION value="fastener s">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
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*****@hotmai lXXX.com> wrote in message
news:u8******** ******@TK2MSFTN GP12.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("descripti on") I would suspect.

TomB

"Sean Dotson" <sean dotson at comcast dot net> wrote in message
news:eS******** ******@TK2MSFTN GP12.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.createOb ject("Chili.Upl oad.1")

Upload.AllowOve rwrite = True ' Generate unique names
'Upload.SizeLim it = 150000 ' Truncate files above 50KB
On Error Resume Next

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

If Upload.SourceFi leExtension = ".pdf" or Upload.SourceFi leExtension =
".zip" Then

If Upload.FileSize < 3000000 Then

UpldAllowed=Tru e

Else
UpldAllowed=Fal se

End If

Else

UpldAllowed=Fal se

End If

If Upload.SourceFi leExtension = ".gif" or Upload.SourceFi leExtension or
".jpg" or Upload.SourceFi leExtension or ".png" Then

If Upload.FileSize < 150000 Then

UpldAllowed=Tru e

Else
UpldAllowed=Fal se

End If

Else

UpldAllowed=Fal se

End If

If UpldAllowed=Fal se Then
Response.Write "<font color=red><b>Yo ur file is either of an disallowed
type or is too large. Please <a href=upload.asp >try
again</a></b></font><br>"
Else
Upload.SaveToFi le(Server.mapPa th("/") & "/" & "/iparttest/upload/" &

FName)
Response.Write "<font color=#000000>< b>File: </b></font>" &
Upload.SourceFi leName & " <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.SourceFi leExtension = ".pdf" or Upload.SourceFi leExtension =
".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.CreateOb ject("ADODB.Con nection")
Conn.Open
"driver={MySQL} ;server=localho st;database=use rname","usernam e","password "
response.write "stuff"
response.write "Descriptio n="
response.write (request.form(" description"))

set the variables
strImageURL = ""
strFilename = FName
strDescription = request.form("d escription")
strAuthor = request.form("a uthor")
strCategory = request.form("c ategory")
strIsVerified = "False"
strUpdateDate = Date

sql = "INSERT INTO iparts
(imageurl,filen ame,description ,author,categor y,isverified,up datedate)

VALUES
('" & strImageURL & "','" & strFilename & "','" & strDescription & "','" & strAuthor & "','" & strCategory & "','" & strIsVerified & "','" &
strUpdateDate & "')"
Conn.Execute(sq l)
Conn.Close

%>

</BODY>
</HTML>
_______________ _______________ _______________
and here is the form:

<html>
<FORM METHOD="POST" ENCTYPE="multip art/form-data"

ACTION="addnewi part.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="descripti on" size="50"></td>
</tr>
<tr>
<td>Select a Category - <a href="categoryh elp.html">Help</a></td>
<td> <SELECT NAME="category" >
<OPTION value="hydrauli cs">Hydraulic s
<OPTION value="pneumati cs">Pneumatic s
<OPTION value="fastener s">Fasteners
<OPTION value="hardware ">Hardware
<OPTION value="powertra nsmission">Powe r Transmission
<OPTION value="fastener s">Fasteners
<OPTION value="fastener s">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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
10333
by: Christopher Brandsdal | last post by:
Hi! I get an error when I run my code Is there any other way to get te information from my form? Heres the error I get and the code beneath. Line 120 is market with ''''''''''''Line 120''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
1
2586
by: Anand | last post by:
Hi i am having trouble adding a recordset into the access database, the code seems to be working fine it passs and parses through all variables just fine without showing any errors and also when i access the recordset it displays the results, what the real issue is that the entry is not made into the database even though i use the Update command and i have also tried the BeginTrans and CommitTrans nothign seems to work and i am unable to...
2
1884
by: James | last post by:
Hi I am having some trouble getting a asp page to load. Im a noob to the asp side. I have followed knowledege base Article 301305. I am running 2000 adv, IIS 5.0 I have the following settings to the folder that has the asp. Application settings
4
5910
by: Zibi | last post by:
I try to use script from www.freeaspupload.net for upload file. I need to store in session object the names of uploaded files but I get an error - Cannot use Request.Form collection after calling BinaryRead How can I make it? Part of this script: <form name="frmSend" method="POST" enctype="multipart/form-data" action="upload_file.asp" onSubmit="return onSubmitForm();"> <span>File 1 :</span> <input type="file" name="file" size="35"
1
5522
by: Avin Patel | last post by:
Hi, I am looking for script to allow multiple files can be uploaded/attached in webform ( mostly cgi/perl or php). But I don't like the multiple input boxes using "<input type="file" size="40" maxlength="40" name="filename">" html tag. As it will limit the no. of files can be uploaded(only as many of this boxes I write in form & doesn't look good in form also). I am looking for multiple file upload in web form using "select" or
9
3154
by: eswanson | last post by:
I have a web page I need to post a file plus some other fields to it. How can I do this from a asp.net page. I know I can send individual fields to the other page, but how do I send a file to the other page, or is there something else like a stream which will be like a file. I am attempting to get a way from writing out a file and then having to give the page that I am posting to the file name. Instead I would like to just from asp.net...
0
1714
by: scottf35 | last post by:
Hi, I am working on (read that - upgrading) an application. This application creates an HTTPWebRequest object, populates it with values which are then sucked out of the Request.Form object (eg someVariable = Request.Form) My problem is that the app doesn't allow input of non-ASCII data in the form. To resolve this I have replace the ContentType from "application/x-www-form-urlencoded" to "multipart/form-data".
4
3801
by: AviCoh | last post by:
Hi, Let me start with the question and then describe my case : Is there a way to read the raw contents of an HTTP request in PHP as a stream (i.e. not get it all at once from Apache) ? In my case I am implementing an API for my server side app. One of the actions in the API allows the posting of binary contents as application/octet-stream. The size of this binary contents can get up to several MBs.
2
6306
by: MDANH2002 | last post by:
Hi From VB.NET I want to simulate the POST request of the following HTML form <html> <title>HTTP Post Testing</title> <body> <form action=http://www.example.com/postdata enctype="multipart/form-data" method="post" name="testform">
0
8863
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8739
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9384
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9238
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9088
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5995
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4502
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3207
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2147
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.