Re: Adding data to file via FTP
| From: | Ignacio Vazquez-Abrams | Date: | Fri, 01 Dec 2000 17:44:15 +0000 |
| Subject: | Re: Adding data to file via FTP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-28234@lists.php.net to get a copy of this message | ||
On Fri, 1 Dec 2000, Ville Mattila wrote:
> Hi there,
>
> I tried to open a file via FTP for adding some data to the end of the file. The connect has
> been opened with fopen() -function. Here is the code strip:
>
> $f = fopen
> ("ftp://user:pass@ftp.pilotmedia.fi/$ftpdir/carts/$sesid.dat",
> "a+");
> fputs ($f, time()."//".$prod."//".$amnt."//\n");
> fclose($f);
>
> Why this doesn't work? PHP causes an error "Warning:
> fopen("ftp://...@ftp.pilotmedia.fi//shopdata/carts/b72986b7ab9fc3a707c7704bc1c5addd.dat","a+")
> - File exists in /home/cust/n/e/nettipaa/www/psite/webshop/addtocart.php3 on line 27"
>
> Is there any way to open the file and write some data to the end of the file via FTP?
>
> Thanks,
> - Ville
>
Not without a LOT of trickery. FTP just doesn't work that way. You'll have to
either pull down the whole file and push it back up after, or finding a
completely different method altogether.
--
Ignacio Vazquez-Abrams <ignacio@openservices.net>