Store Temporary Vale Help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tim James

    Store Temporary Vale Help

    Newbie ASP Question.
    I hope this is the right place to ask.
    I have an ASP Upload element that I need help with.
    This is the problem
    I have 2 fields Image and FileName (FileName isnt the name of Image in this
    case)

    From page 1 I sudmit the 2 fields of info to the Upload Page.
    The info arrives ok at the upload page.
    I browse and select the file and hit submit...
    The info for the Image arrives at destination but the FileName field does
    not.
    Heres the code I have...

    <%
    Dim MyFile
    MyFile = Request("Name")

    if UCase(Request.S erverVariables( "HTTP_METHOD")) ="POST" Then
    Set fu = Server.CreateOb ject("AspUtil.F ileUpload")
    fu.directory = Server.MapPath( ".")
    rc = fu.Upload
    If rc = 0 then
    For n=0 to fu.count-1
    set item = fu.item(n)
    Response.Write "FileName: " & item.filename & "<BR>"
    Response.Write "Bytes written: " & item.Size & "<BR>"
    item.Save
    Next

    Else
    Response.Write "File upload failed. RC: " & rc & "<BR>"
    End If
    response.redire ct "http://dmsproxy/adm/products/add_image.asp?N ewImage=" &
    item.filename & "&FileName= " & MyFile
    Else
    %>
    <form method=post ENCTYPE="multip art/form-data" action="upload_ image.asp">
    <font size="2">&nbsp; Image</font><input type=file name=Image size="20"
    value="<%=Reque st("Image")%>"> <br>
    &nbsp;Name<inpu t type="text" name="Name" size="20"
    value="<%=Reque st("Name")%>">< br>
    <br>
    <input type=submit></form>
    <%
    end If
    %>



    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.542 / Virus Database: 336 - Release Date: 11/18/2003


  • Ray at

    #2
    Re: Store Temporary Vale Help

    You' have to use the upload component to retrieve form field values. I
    don't know that component, but it my something along the lines of:

    sTheTextInput = fu.form.item("N ame")

    Look at the documentation for the component for how to retrieve normal form
    field values.

    Ray at work


    "Tim James" <NOSPAMtimjames _2003@yahoo.com > wrote in message
    news:e7tV%23BGs DHA.2304@TK2MSF TNGP12.phx.gbl. ..[color=blue]
    > Newbie ASP Question.
    > I hope this is the right place to ask.
    > I have an ASP Upload element that I need help with.
    > This is the problem
    > I have 2 fields Image and FileName (FileName isnt the name of Image in[/color]
    this[color=blue]
    > case)
    >
    > From page 1 I sudmit the 2 fields of info to the Upload Page.
    > The info arrives ok at the upload page.
    > I browse and select the file and hit submit...
    > The info for the Image arrives at destination but the FileName field does
    > not.
    > Heres the code I have...
    >
    > <%
    > Dim MyFile
    > MyFile = Request("Name")
    >
    > if UCase(Request.S erverVariables( "HTTP_METHOD")) ="POST" Then
    > Set fu = Server.CreateOb ject("AspUtil.F ileUpload")
    > fu.directory = Server.MapPath( ".")
    > rc = fu.Upload
    > If rc = 0 then
    > For n=0 to fu.count-1
    > set item = fu.item(n)
    > Response.Write "FileName: " & item.filename & "<BR>"
    > Response.Write "Bytes written: " & item.Size & "<BR>"
    > item.Save
    > Next
    >
    > Else
    > Response.Write "File upload failed. RC: " & rc & "<BR>"
    > End If
    > response.redire ct "http://dmsproxy/adm/products/add_image.asp?N ewImage=" &
    > item.filename & "&FileName= " & MyFile
    > Else
    > %>
    > <form method=post ENCTYPE="multip art/form-data" action="upload_ image.asp">
    > <font size="2">&nbsp; Image</font><input type=file name=Image size="20"
    > value="<%=Reque st("Image")%>"> <br>
    > &nbsp;Name<inpu t type="text" name="Name" size="20"
    > value="<%=Reque st("Name")%>">< br>
    > <br>
    > <input type=submit></form>
    > <%
    > end If
    > %>
    >
    >
    >
    > ---
    > Outgoing mail is certified Virus Free.
    > Checked by AVG anti-virus system (http://www.grisoft.com).
    > Version: 6.0.542 / Virus Database: 336 - Release Date: 11/18/2003
    >
    >[/color]


    Comment

    • Tim James

      #3
      Re: Store Temporary Vale Help

      Thanks for the speedy reply Ray.
      This is an old component that I have zipped up and I dont even know the
      author. I has no documentation with it.
      I will have to google it and see what I can find out...
      Thanks again


      "Ray at <%=sLocation% >" <myfirstname at lane34 dot com> wrote in message
      news:#1CpfFGsDH A.3196@TK2MSFTN GP11.phx.gbl...[color=blue]
      > You' have to use the upload component to retrieve form field values. I
      > don't know that component, but it my something along the lines of:
      >
      > sTheTextInput = fu.form.item("N ame")
      >
      > Look at the documentation for the component for how to retrieve normal[/color]
      form[color=blue]
      > field values.
      >
      > Ray at work
      >
      >
      > "Tim James" <NOSPAMtimjames _2003@yahoo.com > wrote in message
      > news:e7tV%23BGs DHA.2304@TK2MSF TNGP12.phx.gbl. ..[color=green]
      > > Newbie ASP Question.
      > > I hope this is the right place to ask.
      > > I have an ASP Upload element that I need help with.
      > > This is the problem
      > > I have 2 fields Image and FileName (FileName isnt the name of Image in[/color]
      > this[color=green]
      > > case)
      > >
      > > From page 1 I sudmit the 2 fields of info to the Upload Page.
      > > The info arrives ok at the upload page.
      > > I browse and select the file and hit submit...
      > > The info for the Image arrives at destination but the FileName field[/color][/color]
      does[color=blue][color=green]
      > > not.
      > > Heres the code I have...
      > >
      > > <%
      > > Dim MyFile
      > > MyFile = Request("Name")
      > >
      > > if UCase(Request.S erverVariables( "HTTP_METHOD")) ="POST" Then
      > > Set fu = Server.CreateOb ject("AspUtil.F ileUpload")
      > > fu.directory = Server.MapPath( ".")
      > > rc = fu.Upload
      > > If rc = 0 then
      > > For n=0 to fu.count-1
      > > set item = fu.item(n)
      > > Response.Write "FileName: " & item.filename & "<BR>"
      > > Response.Write "Bytes written: " & item.Size & "<BR>"
      > > item.Save
      > > Next
      > >
      > > Else
      > > Response.Write "File upload failed. RC: " & rc & "<BR>"
      > > End If
      > > response.redire ct "http://dmsproxy/adm/products/add_image.asp?N ewImage="[/color][/color]
      &[color=blue][color=green]
      > > item.filename & "&FileName= " & MyFile
      > > Else
      > > %>
      > > <form method=post ENCTYPE="multip art/form-data"[/color][/color]
      action="upload_ image.asp">[color=blue][color=green]
      > > <font size="2">&nbsp; Image</font><input type=file name=Image size="20"
      > > value="<%=Reque st("Image")%>"> <br>
      > > &nbsp;Name<inpu t type="text" name="Name" size="20"
      > > value="<%=Reque st("Name")%>">< br>
      > > <br>
      > > <input type=submit></form>
      > > <%
      > > end If
      > > %>
      > >
      > >
      > >
      > > ---
      > > Outgoing mail is certified Virus Free.
      > > Checked by AVG anti-virus system (http://www.grisoft.com).
      > > Version: 6.0.542 / Virus Database: 336 - Release Date: 11/18/2003
      > >
      > >[/color]
      >
      >[/color]


      ---
      Outgoing mail is certified Virus Free.
      Checked by AVG anti-virus system (http://www.grisoft.com).
      Version: 6.0.542 / Virus Database: 336 - Release Date: 11/18/2003


      Comment

      Working...