469,892 Members | 2,145 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,892 developers. It's quick & easy.

copy file

hi everyone
i want to know how to copy file in asp
thanx in advance
Dec 19 '06 #1
1 1438
sashi
1,754 Expert 1GB
hi everyone
i want to know how to copy file in asp
thanx in advance
Hi there,

Kindly refer to below attached sample code segment, hope it helps. Good luck & Take care.

Expand|Select|Wrap|Line Numbers
  1. function CopyFile(strFileSource, strFileDestination, strError)
  2.  
  3. if strFileSource = "" OR strFileDestination = "" then
  4.   strError = "Error - You must supply both a source and a destination"
  5.   exit function
  6. end if
  7.  
  8. set fso = Server.CreateObject("Scripting.FileSystemObject")
  9. if Not fso.FileExists(strFileSource) then
  10.   strError = "Error - Source file does not exist"
  11.   exit function
  12. end if
  13.  
  14.  
  15. if strError = "" then
  16.   Set f2 = fso.GetFile(strFileSource)
  17.   f2.Copy(strFileDestination)
  18.   Set f2 = nothing
  19. end if
  20.  
  21. Set fso = nothing
  22.  
  23. end function
  24.  
Dec 19 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

19 posts views Thread by Claudio Grondi | last post: by
reply views Thread by Joshua Ginsberg | last post: by
5 posts views Thread by DraguVaso | last post: by
8 posts views Thread by luis molina Micasoft | last post: by
7 posts views Thread by lgbjr | last post: by
1 post views Thread by ajc308 | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.