Page 1 of 1

Problem copying files

Posted: Tue Sep 26, 2006 6:29 pm
by winsonlee
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I am trying to copy files from a map directory which is I drive to my local hard disk. But when i tried copying, i got the following error msg. What is the cause of this problem ?


Warning: copy(I:\temp\xxxx.pdf) [function.copy]: failed to open stream: No such file or directory in C:\Program Files\xampp\htdocs\check.php on line 25
failed to copy ...

Code: Select all

$result = mysql_query($sql, $connection);

				 
				while($dbarray = mysql_fetch_array($result)){

          $filename = 'C:/temp/'.trim(strtolower($dbarray[0])).'.pdf';
          $existfilename = 'I:/temp/'.trim(strtolower($dbarray[0])).'.pdf';
          if (file_exists($filename)) {
             echo "The file $filename exists<BR>";
          } else {
     					if (!copy($existfilename, $filename)) {
                 echo "failed to copy $file...\n";
              }

          }

}

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Re: Problem copying files

Posted: Tue Sep 26, 2006 6:52 pm
by volka
If the script runs on another account (e.g. an apache service running as localsystem) it does not have access to the same network mappings as the interactive user.

Posted: Tue Sep 26, 2006 8:00 pm
by winsonlee
Is there any way i can resolve this problem ??

Posted: Tue Sep 26, 2006 8:02 pm
by waradmin
I believe you can give apache access to different directories, drives, etc. Try http://www.google.com/search?hl=en&sa=X ... es&spell=1 its got some links to get you started im sure.

Posted: Wed Sep 27, 2006 4:20 pm
by feyd
winsonlee, please start using syntax highlighting tags.