472,127 Members | 2,046 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,127 software developers and data experts.

copy file

hi everyone
i want to know how to copy file in asp
thanx in advance
Dec 19 '06 #1
1 1545
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 leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.