Trouble with Request.Form Plus Upload

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sean Dotson

    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


    Check the Inventor FAQ for most common questions

    -----------------------------------------------------------------------


  • TomB

    #2
    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("descripti on") I would suspect.

    TomB

    "Sean Dotson" <sean dotson at comcast dot net> wrote in message
    news:eSxsHcrMEH A.1608@TK2MSFTN GP12.phx.gbl...[color=blue]
    > I have a form that passes variables to an asp file and then uploads a[/color]
    file.[color=blue]
    > 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/" &[/color]
    FName)[color=blue]
    > Response.Write "<font color=#000000>< b>File: </b></font>" &
    > Upload.SourceFi leName & " <font color=#009900>< b>--Size:" &[/color]
    Upload.FileSize[color=blue]
    > &" 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[/color]
    in[color=blue]
    > 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 &[/color]
    "</b></font>"[color=blue]
    > 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)[/color]
    VALUES[color=blue]
    > ('" & 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"[/color]
    ACTION="addnewi part.asp">[color=blue]
    >
    > <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
    > -----------------------------------------------------------------------
    >
    >[/color]


    Comment

    • Sean Dotson

      #3
      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


      Check the Inventor FAQ for most common questions

      -----------------------------------------------------------------------
      "TomB" <shuckle@hotmai lXXX.com> wrote in message
      news:u81jVsrMEH A.2628@TK2MSFTN GP12.phx.gbl...[color=blue]
      > 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[/color]
      own[color=blue]
      > 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:eSxsHcrMEH A.1608@TK2MSFTN GP12.phx.gbl...[color=green]
      > > I have a form that passes variables to an asp file and then uploads a[/color]
      > file.[color=green]
      > > 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/" &[/color]
      > FName)[color=green]
      > > Response.Write "<font color=#000000>< b>File: </b></font>" &
      > > Upload.SourceFi leName & " <font color=#009900>< b>--Size:" &[/color]
      > Upload.FileSize[color=green]
      > > &" 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[/color]
      > in[color=green]
      > > 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 &[/color]
      > "</b></font>"[color=green]
      > > 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
      > >[/color][/color]
      "driver={MySQL} ;server=localho st;database=use rname","usernam e","password "[color=blue][color=green]
      > >
      > > 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)[/color]
      > VALUES[color=green]
      > > ('" & strImageURL & "','" & strFilename & "','" & strDescription & "','"[/color][/color]
      &[color=blue][color=green]
      > > 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"[/color]
      > ACTION="addnewi part.asp">[color=green]
      > >
      > > <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
      > > -----------------------------------------------------------------------
      > >
      > >[/color]
      >
      >[/color]


      Comment

      Working...