Re: Renaming file names at the upload

  •  01-29-2016, 9:12 AM

    Re: Renaming file names at the upload

    hi,

     

    Please check the example page below, it shows you how to rename the upload file and save to the location you set for. the uploader control has not the function to connect with your database, so you need to write your own code to save the info into your database.

     

    1. <%@ Language="VBScript" %>  
    2. <!-- #include file="aspuploader/include_aspuploader.asp" -->  
    3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  
    4. <html xmlns="http://www.w3.org/1999/xhtml">  
    5. <head>  
    6.     <title>  
    7.         Form - Single File Upload  
    8.     </title>  
    9. </head>  
    10. <body>  
    11.     <div class="demo">  
    12.                           
    13.         <h2>Single File Upload</h2>  
    14.         <p> A basic sample demonstrating the use of the Upload control.</p>  
    15.           
    16.         <!-- do not need enctype="multipart/form-data" -->  
    17.         <form id="form1" method="POST">  
    18.             <%  
    19.             Dim uploader  
    20.             Set uploader=new AspUploader  
    21.             uploader.MaxSizeKB=10240  
    22.             uploader.Name="myuploader"  
    23.             uploader.InsertText="Upload File (Max 10M)"  
    24.             uploader.MultipleFilesUpload=true  
    25.             %>  
    26.             <%=uploader.GetString() %>  
    27.         </form>  
    28.           
    29.         <br/><br/>  
    30.           
    31. <%  
    32. If Request.Form("myuploader")&""<>"" Then  
    33.     Dim mvcfile  
    34.     Set mvcfile=uploader.GetUploadedFile(Request.Form("myuploader"))  
    35.     mvcfile.MoveTo("C:\inetpub\wwwroot\aspuploader\test\myPhoto.jpg")  
    36. End If  
    37.   
    38. %>  
    39.                           
    40.     </div>  
    41. </body>  
    42. </html>  
     

    regards,

     

    Ken 

View Complete Thread