VTS Posted June 22, 2006 Share Posted June 22, 2006 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 Link to comment https://forums.phpfreaks.com/topic/12669-copying-a-file/ Share on other sites More sharing options...
jvrothjr Posted June 22, 2006 Share Posted June 22, 2006 [!--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. Quote Link to comment https://forums.phpfreaks.com/topic/12669-copying-a-file/#findComment-48588 Share on other sites More sharing options...
VTS Posted June 22, 2006 Author Share Posted June 22, 2006 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 Link to comment https://forums.phpfreaks.com/topic/12669-copying-a-file/#findComment-48593 Share on other sites More sharing options...
Eric_Ryk Posted June 22, 2006 Share Posted June 22, 2006 [!--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. Quote Link to comment https://forums.phpfreaks.com/topic/12669-copying-a-file/#findComment-48596 Share on other sites More sharing options...
jvrothjr Posted June 22, 2006 Share Posted June 22, 2006 [!--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.... Quote Link to comment https://forums.phpfreaks.com/topic/12669-copying-a-file/#findComment-48597 Share on other sites More sharing options...
VTS Posted June 22, 2006 Author Share Posted June 22, 2006 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] Quote Link to comment https://forums.phpfreaks.com/topic/12669-copying-a-file/#findComment-48603 Share on other sites More sharing options...
Eric_Ryk Posted June 22, 2006 Share Posted June 22, 2006 That's part of ActiveX, which only works in internet explorer, and sometiems ActiveX is disabled so it doesn't even work there. Quote Link to comment https://forums.phpfreaks.com/topic/12669-copying-a-file/#findComment-48613 Share on other sites More sharing options...
VTS Posted June 22, 2006 Author Share Posted June 22, 2006 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 Link to comment https://forums.phpfreaks.com/topic/12669-copying-a-file/#findComment-48618 Share on other sites More sharing options...
Eric_Ryk Posted June 22, 2006 Share Posted June 22, 2006 [!--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. Quote Link to comment https://forums.phpfreaks.com/topic/12669-copying-a-file/#findComment-48622 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.