Support forums
in

Renaming file names at the upload

Last post 03-11-2016, 10:47 AM by gptouring. 3 replies.
Sort Posts: Previous Next
  •  01-28-2016, 9:14 PM 82359

    Renaming file names at the upload

     

    I would like to rename the file names of the loaded pictures and store in my database directly at the upload

    Example:
    home.png = 1_1.png
    house.png = 1_2.png

    How a script must look this renames the pictures and submits the new file name to the entry in the database?

    Meaning many thanks for every help
    Thomas
     

  •  01-29-2016, 9:12 AM 82364 in reply to 82359

    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 

  •  01-29-2016, 5:49 PM 82367 in reply to 82364

    Re: Renaming file names at the upload

     

    Hi, Ken

    Your help thanks you for, your script has provided the right approach to me.


    Greetings

    Thomas

  •  03-11-2016, 10:47 AM 82598 in reply to 82367

    Re: Renaming file names at the upload

    Did you get it to work? And if so, what was the final code?
    Grae

    GP Touring
    www.gptouring.com.au
View as RSS news feed in XML
Powered by Community Server (Commercial Edition), by Telligent Systems