fso.CopyFile - Copy File fromClient to Server (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


aesquivel -> fso.CopyFile - Copy File fromClient to Server (11/18/2003 12:57:43)

ASP page...trying to use FSO.CopyFile to move a file from the client box to the server box. It is not allowing me to do this? Is this possible if so why is it not working for me? Or is there another way to move a file from a users client box to the server box?

thanks


My code:

Dim fso


Set fso = Server.CreateObject("Scripting.FileSystemObject")

fso.CopyFile "c:\file.xxx","\\servername\shareddir\file.xxx"




Long Island Lune -> RE: fso.CopyFile - Copy File fromClient to Server (11/18/2003 13:22:04)

quote:

fso.CopyFile "c:\file.xxx","\\servername\shareddir\file.xxx"

sourceFile = Server.Mappath ("C:\source location on your hard drive\your file")
destFile = Server.Mappath ("/servername/shareddir")
fso.CopyFile sourceFile, destFile, true


Do not put the name of the file in destFile, just the path. Reverse the slashes in destFile too. You had them backwards.

Check this out:
http://www.sloppycode.net/fso/?m=52




Spooky -> RE: fso.CopyFile - Copy File fromClient to Server (11/18/2003 13:23:24)

I think you really want an upload component?
Either asp based or whatever your host provides.

http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=7361&lngWId=4




aesquivel -> RE: fso.CopyFile - Copy File fromClient to Server (11/18/2003 15:11:02)

I tired using the Long Islands code but that still didn't work for me...and I went to that site ...but I can't download the from the site...how do I download the zip from that site?




Long Island Lune -> RE: fso.CopyFile - Copy File fromClient to Server (11/18/2003 15:19:26)

If your still interested in the code line, post what you tried to do (from my example above).

If your interested in Spooky's script instead - disregard this post. [;)]




Spooky -> RE: fso.CopyFile - Copy File fromClient to Server (11/18/2003 15:30:16)

Should be this link :

http://www.pscode.com/vb/scripts/ShowZip.asp?lngWId=4&lngCodeId=7361&strZipAccessCode=tp%2FU73611632




aesquivel -> RE: fso.CopyFile - Copy File fromClient to Server (11/18/2003 15:36:33)

Whatever works for me is fine...here is my code.....does there need to be any code

in the <!-- #INCLUDE FILE="./include/clsUpload.asp"--> file? I'm doing this in a save function tha calls the function that runs the upload. Since I'm trying to



Function SaveRec()
.....

psV5 = "c:\temp\green.wav" 'this is my local box, retrieve the dest path from a input field box



Call WaveFileUpload(psV5) --- this call is inside save function
....

End Function



Function WaveFileUpload(byRef sWaveFilePath)
dim sourceFile
dim destFile
dim fso

Set fso = Server.CreateObject("Scripting.FileSystemObject")

sourceFile = server.MapPath (sWaveFilePath)
destFile = server.MapPath("//docappa/Interfaces/VoicePortal/Inbox") 'this is a SHARED SERVER DIR DOES THAT MATTER?

fso.CopyFile sourceFile, destFile, true

Set fso = nothing

End Function




Long Island Lune -> RE: fso.CopyFile - Copy File fromClient to Server (11/18/2003 17:10:33)

quote:

destFile = server.MapPath("//docappa/Interfaces/VoicePortal/Inbox") 'this is a SHARED SERVER DIR DOES THAT MATTER?

No - it doesn't matter.
What does mater is that you have write access (R/W/D) to that directory in your tree.


Try either of these:

("/docappa/Interfaces/VoicePortal/Inbox")

("../docappa/Interfaces/VoicePortal/Inbox")




Long Island Lune -> RE: fso.CopyFile - Copy File fromClient to Server (11/18/2003 17:11:58)

quote:

sourceFile = server.MapPath (sWaveFilePath)


One more thing..

What is sWaveFilePath?
Is this a FULL path and file name to the file on your HD?




aesquivel -> RE: fso.CopyFile - Copy File fromClient to Server (11/18/2003 17:21:42)

YES, sWaveFilePath is the location & file name (c:\temp\green.wav)...where the file is coming from....so it would be the client box(user). So if the sWaveFilePath is the users box...then do I need to use "server.MapPath(sWaveFilePath)?


I'll check on the write access..and try it again...thanks again for helping me out.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.046875