using Virtual path ,aspupload

Discussion in 'Classic ASP' started by malbar99, Mar 11, 2006.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. hi,
    I'm trying to upload file using Virtual path and also need to use upload to memory, is this possible.
    I need to send each file to separate folder , after rename the file .

    1- using Virtual path( required from hosting company)
    2- renaming files
    3- send file to separate folder



    I get this error
    Persits.Upload.1 error '800a003e'
    Save method must not be called more than once.

    /araburban/a.asp, line 14



    my code is so simple :

    html form :

    <html>
    <head>
    </head>

    <form action="a.asp" method="post" enctype="multipart/form-data">
    <input type="file" size="40" name="FILE1" >
    Select destination subdirectory:

    <SELECT NAME="Subdir">
    <OPTION>Folder1</OPTION>
    <OPTION>Folder2</OPTION>
    <OPTION>Folder3</OPTION>

    </SELECT>

    <input type="submit" value="Upload!" >
    </form>
    </body>
    </html>




    the asp page

    <HTML>

    <%
    Set Upload = Server.CreateObject("Persits.Upload")

    ' we use memory uploads, so we must limit file size
    Upload.SetMaxSize 500000, True

    ' Save to memory. Path parameter is omitted
    Upload.SaveToMemory

    '
    count = Upload.SaveVirtual ("aspupload/Article/")

    Response.Write Count &amp; " file(s) uploaded"%>
    </BODY>
    </HTML>
     
  2. It looks like "Persits.Upload" doesn't allow you to call SaveToMemory, then call SaveVirtual.

    Try using this example taken from http://www.aspupload.com/Manual.htm




    <%


    Set Upload = Server.CreateObject("Persits.Upload.1")
    ' ensure a unique name when calling File.SaveAs
    Upload.OverwriteFiles = False
    Count = Upload.SaveToMemory


    If Count = 1 Then ' 1 file uploaded
    Set File = Upload.Files(1)


    ' retrieve destination file name from a HIDDEN form item
    ' I modified thisto use Server.MapPath
    Path = Server.MapPath("/aspupload/Article/" &amp; Upload.Form("Filename"))
    ' Side effect: SaveAs sets changes File.Path property to a new value.
    File.SaveAs Path
    Response.Write "File was saved as " &amp; File.Path
    Else
    Response.Write "No files were uploaded."
    End If
    %>


    Joel Thoms
    DiscountASP.NET
    http://www.DiscountASP.NET
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page