Re: how can i change filename after upload

  •  08-16-2012, 8:46 AM

    Re: how can i change filename after upload

    Hi kambak,
     
    1. you can handle the upload file name by method "CopyTo". The example page below shows you how to handle the upload file store location and the new file name.
     
     
    <%@ Language="VBScript" %>
    <!-- #include file="aspuploader/include_aspuploader.asp" -->
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>
    Form - Single File Upload
    </title>
    </head>
    <body>
    <div class="demo">
                            
            <h2>Single File Upload</h2>
    <p> A basic sample demonstrating the use of the Upload control.</p>
    <!-- do not need enctype="multipart/form-data" -->
    <form id="form1" method="POST">
    <%
    Dim uploader
    Set uploader=new AspUploader
    uploader.MaxSizeKB=10240
    uploader.Name="myuploader"
    uploader.InsertText="Upload File (Max 10M)"
    uploader.MultipleFilesUpload=true
    %>
    <%=uploader.GetString() %>
    </form>
    <br/><br/>
    <%
    If Request.Form("myuploader")&""<>"" Then
    Dim mvcfile
    Set mvcfile=uploader.GetUploadedFile(Request.Form("myuploader"))
        mvcfile.CopyTo("C:\inetpub\wwwroot\aspuploader\test\"+"newfilename.jpg")
    End If
    %>
    </div>
    </body>
    </html>
     
    2. Do not need to set the full path for the SaveDirectly.
     
    Try create a folder name "savefile" under the root of your site and set uploader.SaveDirectory="savefiles"
     
    Regards,
     
    Ken 
View Complete Thread