RE: [PHP] Copying file to a network drive (in WinNT4)

From: Date: Thu, 27 Sep 2001 17:49:38 +0000
Subject: RE: [PHP] Copying file to a network drive (in WinNT4)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-69030@lists.php.net to get a copy of this message
Hi, I haven't used PHP on NT, but would expect copy to work. You might first confirm that the values of $dest and $src are as you expect them to be. Also, make sure that you have permission to create/modify the $dest file. Trapping errors never hurts either. $dest = "h:\\".$code.".jpg"; $src = $img; if (!copy($src, $dest)) { print "<BR>ERROR COPYING ($src) to ($dest)<BR>\n"; } I notice that the JPG in your error message is different from the name you said is causing the problem, "punatalo". Also, is line 14 of your PHP script the copy($src, $dest); line? Or some other line? Take care, -Joe > -----Original Message----- > From: Ville Mattila [mailto:ville.mattila@pilotmedia.fi] > Sent: Thursday, September 27, 2001 10:25 AM > To: php-general@lists.php.net > Subject: [PHP] Copying file to a network drive (in WinNT4) > > > 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 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net > >

« previous php.general (#69030) next »