Copying file to a network drive (in WinNT4)
| From: | Ville Mattila | Date: | Thu, 27 Sep 2001 17:24:39 +0000 |
| Subject: | Copying file to a network drive (in WinNT4) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-69025@lists.php.net to get a copy of this message | ||
Hi there!
I asked this question at phpbuilder.com earlier today, but there was no answers given. So I post
this same message now here. Hope that someone has some kind of idea how the copy could be success...
Cheers,
- Ville
* *
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
Executive Manager
Pilotmedia
Tapiolankatu 11
39500 IKAALINEN
gsm +358-40-8497506
fax +358-3-4589080
ville.mattila@pilotmedia.fi
www.pilotmedia.fi