Newbie - Renaming image files

Results 1 to 2 of 2

Thread: Newbie - Renaming image files

  1. #1
    Join Date
    Dec 1969

    Default Newbie - Renaming image files

    Im working on an ASP page that allows users to upload their own images. <BR>To prevent users from entering images with the same name, I want the ASP page to append a digit to the file name (eg image.jpg to image1.jpg) so that all file names will be unique. <BR>Ive got the names saved into the database with no problems by implementing a loop where count is appended on the file name<BR>count = 0<BR>mcount = 1<BR>do while mcount &#060;=20 &#039max 20 images<BR>count = count + 1<BR><BR> and replacing ".jpg" with <BR> count & ".jpg" <BR>The questions is, how do the same on the actual file name so that images will be viewable? <BR>thanks<BR>Susanna

  2. #2
    Join Date
    Dec 1969

    Default RE: Newbie - Renaming image files

    Use the filesystem object.<BR><BR>Set fso = CreateObject("Scripting.FileSystemObject")<BR>Set f = fso.GetFile(filespec)<BR>f.Name = {newName}<BR><BR>(or f.Name = replace(f.Name,".jpg",count&".jpg")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts