SV: [PHP] Copying file to a network drive (in WinNT4)
| From: | joakim dot andersson at cybercom dot se | Date: | Fri, 28 Sep 2001 08:28:35 +0000 |
| Subject: | SV: [PHP] Copying file to a network drive (in WinNT4) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-69139@lists.php.net to get a copy of this message | ||
My best bet is that PHP doesn't know that h:\ exists. I have seen similar
things before,
though not in PHP. Have you tried using the UNC path instead
(\\COMPUTER\SHARE)?
>I also tried to execute a direct copy command via command prompt:
>$cmd = "cmd /c copy $src $dest";
>passthru($cmd);
Try mounting the network drive in PHP then copy the file:
$cmd = "cmd /c net use h: \\COMPUTER\SHARE"; //Mount drive
passthru($cmd);
//Copy the file here
$cmd = "cmd /c net use h: /delete"; //Unmount the drive
passthru($cmd);
/Joakim
> -----Ursprungligt meddelande-----
> Från: Warren Vail [mailto:warren@availabletech.com]
> Skickat: fredag den 28 september 2001 03:37
> Till: joe.kaiping@home.com; php-general@lists.php.net
> Kopia: ville.mattila@pilotmedia.fi
> Ämne: RE: [PHP] Copying file to a network drive (in WinNT4)
>
>
> Let me know what you find, if anything. Seems I may be encountering a
> similar problem executing mysqldump from a php script as a
> scheduled command
> on nt4. I can execute the command writing to a local drive
> and a remote
> drive when I execute from the DOS command line, but when running as a
> scheduled (the AT command), the copy to the local drive works, but the
> remote mounted drive fails. Does this sound similar?
>
> Good Luck,
>
> Warren Vail
>
> -----Original Message-----
> From: Joe Kaiping [mailto:joe.kaiping@home.com]
> Sent: Thursday, September 27, 2001 12:30 PM
> To: php-general@lists.php.net
> Cc: ville.mattila@pilotmedia.fi
> Subject: RE: [PHP] Copying file to a network drive (in WinNT4)
>
>
>
> > -----Original Message-----
> > From: Ville Mattila [mailto:ville.mattila@pilotmedia.fi]
> > Sent: Thursday, September 27, 2001 11:10 AM
> > To: joe.kaiping@home.com; php-general@lists.php.net
> > Subject: Re: [PHP] Copying file to a network drive (in WinNT4)
> >
> > > Also, make sure that you have permission to create/modify
> > the $dest file.
> >
> > Should be, because I can copy the file via "normal way" in
> Windows....
> >
> >
>
> Hi again,
>
> Not sure what you're up against. I searched
> http://www.php.net to confirm
> h:\file is the correct Windows file system syntax to use.
> Seems to be.
> Also there is no mention of copy() not working on windows,
> (except for when
> using a sharename instead of a mapped drive name. (But you're
> using a mapped
> drive name, h))
>
> The apache daemon on unix runs under the permissions of a
> certain system
> user, usually "nobody". Not sure how NT does it, but if it
> also runs under
> a specific user, maybe that user doesn't have permission to
> write to the
> file?
>
> However, the version of PHP I'm running gives a "Permissions"
> error message
> when it doesn't have permission to write to the file. You
> got the following
> error instead, but I'm not sure about the behavior of PHP on
> windows, maybe
> a different error message is output when you don't have permission.
>
> Warning: Unable to create 'h:\redhouse.jpg': Invalid argument in
> c:\apache\htdocs\copypic.php on line 14
>
> Anyway, I was unable to reproduce the "Invalid argument"
> error on Unix. I
> would doubt that there in a bug with copy() for Windows
> without it already
> appearing on the PHP site. So I'd guess that it is caused because PHP
> doesn't like the format of the contents of either $src or
> $dest. I'd suggest
> going over those again with a magnifying glass. It sounds
> like you already
> have, though, so I'm out of thoughts for right now.
>
> Sorry for not being able to help any more. Best of luck!
>
> -Joe
>
>
> --
> 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
>
>
>
> --
> 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
>