Connecting Tech Pros Worldwide Forums | Help | Site Map

asp classic vb6: upload multipe image. Rename files and delete.

Newbie
 
Join Date: Aug 2009
Posts: 3
#1: 2 Weeks Ago
hi, i try to upload a multiple image files. after that i will rename the files name.
the problem is when i upload a 2 or more same files name exp-goal.jpg, it will return "files already exist". ok this is my codes,
Expand|Select|Wrap|Line Numbers
  1.  
  2. Set Upload = Server.CreateObject("Persits.Upload.1")
  3. Count = Upload.Save("d:\cmsupload\cimg\")
  4.  
  5. for each File in upload.Files
  6. '
  7. '...sme operation here..
  8.  
  9. set rename = CreateObject("scripting.FileSystemObject")
  10. set f = rename.GetFile(filepath1)
  11. f.Copy "d:\www\cmsupload\cimg\" newname & "." & Ext, false
  12. next 
and then i try to delete the data using this
Expand|Select|Wrap|Line Numbers
  1. Set Upload = Server.CreateObject("Persits.Upload.1")
  2. Count = Upload.Save("d:\cmsupload\cimg\")
  3. for each File in upload.Files
  4. '
  5. '...sme operation here..
  6.  
  7. set rename = CreateObject("scripting.FileSystemObject")
  8. set f = rename.GetFile(filepath1)
  9. f.Copy "d:\www\cmsupload\cimg\" newname & "." & Ext, false
  10.  
  11. Set fso = CreateObject("Scripting.FileSystemObject")
  12. fso.Deletefile ("c:\windows\desktop\" & oldname) 
  13. next
  14.  
but it return error, file no found.
it work perfectly if i insert the diffrent files name but something i dont really understood in here isn't the upload.Files will functioning like an array? array(0) then if next, array(1) and continue...

Reply

Tags
upload multiple image