Re: Rename File

  •  05-05-2011, 12:00 PM

    Re: Rename File

    Dear msandwisch,
     
    You can rename uploaded files in this method, please refer to the following code:
     
    <%@ Language="VBScript" %>   
    <!-- #include file="aspuploader/include_aspuploader.asp" -->  
    <html>   
    <head>   
    </head>   
    <body>   
            <form id="form1" method="POST">   
            <%   
                Dim uploader   
                Set uploader=new AspUploader   
                uploader.Name="myuploader"  
                uploader.Render()   
            %>   
            </form>   
                   
    <%   
      
    If Request.Form("myuploader")&""<>"" Then  
        Dim mvcfile   
        Set mvcfile=uploader.GetUploadedFile(Request.Form("myuploader"))   
        targetfilepath= "savefiles/myprefix_" & mvcfile.FileName  
        mvcfile.CopyTo( server.mappath(targetfilepath))
        mvcfile.MoveTo( server.mappath(targetfilepath))
        Response.Write("<div style='font-family:Fixedsys'>")   
        Response.Write("Uploaded File")   
        Response.Write("<br/><br/>FileName: ")   
        Response.Write(mvcfile.FileName)   
        Response.Write("<br/>FileSize: ")   
        Response.Write(mvcfile.FileSize)
        Response.Write("</div>")   
    End If %>
    </body>   
    </html>
     
    Thank you for asking
View Complete Thread