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.
-
function CopyFile(strFileSource, strFileDestination, strError)
-
-
if strFileSource = "" OR strFileDestination = "" then
-
strError = "Error - You must supply both a source and a destination"
-
exit function
-
end if
-
-
set fso = Server.CreateObject("Scripting.FileSystemObject")
-
if Not fso.FileExists(strFileSource) then
-
strError = "Error - Source file does not exist"
-
exit function
-
end if
-
-
-
if strError = "" then
-
Set f2 = fso.GetFile(strFileSource)
-
f2.Copy(strFileDestination)
-
Set f2 = nothing
-
end if
-
-
Set fso = nothing
-
-
end function
-