Hi there,
I have a kind of problem when trying to copy a file from local hard drive to a network drive. If I use usual copy() -function, I'll get following error:
Warning: Unable to create 'h:\redhouse.jpg': Invalid argument in c:\apache\htdocs\copypic.php on line 14
The code which should execute the copy looks this:
$dest = "h:\".$code.".jpg";
$src = $img;
copy($src, $dest);
$code is a simple text which tells the destination name - in this case it's "punatalo". $img is the full path to the source file and this is taken from the URL (copypic.php?img=c:\house.jpg for an example).
I also tried to execute a direct copy command via command prompt:
$cmd = "cmd /c copy $src $dest";
passthru($cmd);
But the result is that there comes text "0 file(s) copied". And this will happen as well as when I make a .bat file which makes the copy...
Anyway, if I execute the copy command in the Command Prompt itself (without PHP, I mean):
copy c:\house.jpg h:\redhouse.jpg
works fine!
And as well as if I take Start -> Run and then execute
cmd /c copy c:\house.jpg h:\redhouse.jpg
everything works fine!
Whatever, there seems to be no way to copy via PHP... 😉 Any ideas?
- Ville Mattila
Ikaalinen, Finland