Jump to content

Copying a file


VTS

Recommended Posts

I have been trying to copy a file using php but for some reason, I cannot copy a file from a drive on the network to my c drive using the copy function. I can copy files from one place on my c: to another place on my c: but as soon as I try to copy a file from a network drive it tells me the file does not exist.

The only thing I could think to do was to find a workaround for this by using javascript to copy the file to my c: so I can use it. The problem I have is that I dont know how to imbed javascript into my php. If anyone could give me some ideas on how to fix the problem with not being able to copy from a network drive or how to imbed javascript into my php I would greatly appreciate it.
Link to comment
https://forums.phpfreaks.com/topic/12669-copying-a-file/
Share on other sites

[!--quoteo(post=386952:date=Jun 22 2006, 04:08 PM:name=VTS)--][div class=\'quotetop\']QUOTE(VTS @ Jun 22 2006, 04:08 PM) [snapback]386952[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I have been trying to copy a file using php but for some reason, I cannot copy a file from a drive on the network to my c drive using the copy function. I can copy files from one place on my c: to another place on my c: but as soon as I try to copy a file from a network drive it tells me the file does not exist.

The only thing I could think to do was to find a workaround for this by using javascript to copy the file to my c: so I can use it. The problem I have is that I dont know how to imbed javascript into my php. If anyone could give me some ideas on how to fix the problem with not being able to copy from a network drive or how to imbed javascript into my php I would greatly appreciate it.
[/quote]

if you are using apache/php apache dont like to work with mapped drives basiclly because apache starts as a server before mappings are set...... there for does not see the mappings.
Link to comment
https://forums.phpfreaks.com/topic/12669-copying-a-file/#findComment-48588
Share on other sites

[!--quoteo(post=386967:date=Jun 22 2006, 04:27 PM:name=VTS)--][div class=\'quotetop\']QUOTE(VTS @ Jun 22 2006, 04:27 PM) [snapback]386967[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Thanks for the info and yes, I am using apache. So I guess this means that I have to use the javascript then. Anyone know how to imbed that into my php?
[/quote]How exactly would you plan to use javascript to copy a file? I think you are overestimating its ability.
Link to comment
https://forums.phpfreaks.com/topic/12669-copying-a-file/#findComment-48596
Share on other sites

[!--quoteo(post=386967:date=Jun 22 2006, 04:27 PM:name=VTS)--][div class=\'quotetop\']QUOTE(VTS @ Jun 22 2006, 04:27 PM) [snapback]386967[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Thanks for the info and yes, I am using apache. So I guess this means that I have to use the javascript then. Anyone know how to imbed that into my php?
[/quote]


I use a round about way with FTP running on a logged in user.

I just create a FTP User ID that was rights to that mapped network drive and copy the files via FTP to get to that network drive.

In my case I only have three subfolder so I have three Id's.........

This was my workaround but the machine that runs the FTP server has to be logged in and not started as a serve but started as a program after login....

Link to comment
https://forums.phpfreaks.com/topic/12669-copying-a-file/#findComment-48597
Share on other sites

Thanks for the help once again jvrothjr! I think If possible I will try the javascript but if that doesnt work out, I will consider what you use as a workaround.




[!--quoteo(post=386970:date=Jun 22 2006, 03:30 PM:name=Eric_Ryk)--][div class=\'quotetop\']QUOTE(Eric_Ryk @ Jun 22 2006, 03:30 PM) [snapback]386970[/snapback][/div][div class=\'quotemain\'][!--quotec--]
How exactly would you plan to use javascript to copy a file? I think you are overestimating its ability.
[/quote]

Well I found a script when I was looking on google that is supposed to use javascript to copy a file from one location to another. This was what I found:

[code]<!--
myActiveXObject = new ActiveXObject("Scripting.FileSystemObject");
file = myActiveXObject.GetFile("c:\\test.txt");
file.copy("d:\\test.txt", true);
// -->[/code]
Link to comment
https://forums.phpfreaks.com/topic/12669-copying-a-file/#findComment-48603
Share on other sites

[!--quoteo(post=386992:date=Jun 22 2006, 05:30 PM:name=VTS)--][div class=\'quotetop\']QUOTE(VTS @ Jun 22 2006, 05:30 PM) [snapback]386992[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Hmm...well I guess that kinda kills javascript. I guess I will have to try to use the workaround that jvrothjr uses unless you have any suggestions. Thanks for the replies guys.
[/quote]
Might be able to use sockets.
Link to comment
https://forums.phpfreaks.com/topic/12669-copying-a-file/#findComment-48622
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.