Re: How do I use fopen() to overwrite a remote file via ftp?
| From: | Dalton Hunter | Date: | Tue, 09 Apr 2002 02:42:55 +0000 |
| Subject: | Re: How do I use fopen() to overwrite a remote file via ftp? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-92159@lists.php.net to get a copy of this message | ||
Hi, the manual page for fopen indicates one can use it with ftp ...
"You can open files for either reading or writing via ftp"
... Just trying to figure out how one can properly overwrite files with
fopen via ftp, if at all, as I don't want to have to recompile PHP with the
FTP functions and use those.
"Cc Zona" <email@cczona.com> wrote in message
news:email-02400F.19145508042002@pb1.pair.com...
> In article <20020409014028.45901.qmail@pb1.pair.com>,
> daltonhunter@iname.com (Dalton Hunter) wrote:
>
> > Hi, I want to use fopen to connect to a remote server via ftp and
overwrite
> > a file like ...
> >
> >
> > fopen("ftp://username:password@www.domain.com/system/path/to/file.php",
"w")
> >
> > ... but after connecting I get the "Warning: File already exists" error
> > message and it fails. What is the proper way to overwrite it?
>
> By using the FTP functions, not fopen (quote from
> <http://php.net/fopen>:
> "HTTP connections are read-only; you cannot write data or copy files to an
> HTTP resource").
>
> The example on the FTP chapter's intro page
> <http://php.net/ftp>
> demonstrates how.
>
> --
> CC