I read the manual at the php.net site and the only thing I can come up with
is the several security oriented possibility.
Read over the page and the anotations and see if that sheds any possible
light for you. Nothing else comes right to mind.
http://www.php.net/manual/en/function.fopen.php
Adam Lang
Systems Engineer
Rutgers Casualty Insurance Company
http://www.rutgersinsurance.com
----- Original Message -----
From: "Arnold Angerer" <aangerer@a...>
To: "professional php" <pro_php@p...>
Sent: Sunday, May 06, 2001 6:16 AM
Subject: [pro_php] file uploading problem using fopen
> Hi!
>
> I'm using the following function:
>
> function uploadFile( $srcFileName , $ftpServerAddress, $ftpUser,
$ftpPassword, $ftpFileName )
> {
> // open source file for reading
> $sfile = fopen($srcFileName,r);
>
> if( $sfile ){
> // destination file
> $dfile = @fopen("ftp://" . $ftpUser . ":" . $ftpPassword . "@" .
$ftpServerAddress . $ftpFileName ,"w"); // this one fails when file already
exists
>
> if( $dfile ){
> echo("File open to FTP succeeded");
> fwrite( $dfile, fread($sfile, filesize($srcFileName)));
> fclose( $dfile );
> }
> else{
> echo("File open to FTP failed miserably-1"); // ---> that's the
error-message I get
> }
>
> fclose( $sfile );
> }else{
> echo("File open failed miserably-2");
> }
> }
>
>
> As long as the file does not exist on the server, the script is working
fine. When I'm trying to overwrite an existing file, fopen fails...
>
> Regards,
>
> Arnold Angerer
>
>