Re: FTP Trouble

From: Date: Thu, 29 Jun 2000 08:23:44 +0000
Subject: Re: FTP Trouble
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-3829@lists.php.net to get a copy of this message
Phillip, This code is writing exactly 60 bytes (including the newline \n) on line 9. If you echo "$HTTP_USER_AGENT" to your browser, you will see this same string. Maybe you want something more like this?: <?php if (!($fp1 = fopen('my_local_file_name.txt','r'))) die("Could not open source file!"); if (!($fp2 = fopen('ftp://ftp.php.net/incoming/outputfile','w'))) die("Could not open destination file!"); while ($contents = fread ($fp1, 4096)) fwrite($fp2, $contents, strlen($contents)); fclose($fp1); fclose($fp2); ?> At 6/29/2000 04:15 PM, Phillip S. Baker wrote: >2 <?php > 3 $file = > fopen("ftp://ftp.php.net/incoming/outputfile", > "w"); > 4 if (!$file) { > 5 echo "<p>Unable to open remote file for writing.\n"; > 6 exit; > 7 } > 8 /* Write the data here. */ > 9 fputs($file, "$HTTP_USER_AGENT\n"); > 10 fclose($file); > 11 ?> > >And this worked in sending files to my anonftp directory just fine. > >However at some point today it stopped working. every file that gets >sent up is 60byte in size and cannot be viewed (our opened as I am >sending up zipped files) > >If you look at the file all that you see is > >Mozilla/4.0 (compatible; MSIE 5.01; windows NT 5.0; DigExt) -- /* SteeleSoft Consulting John Steele - Systems Analyst/Programmer * We also walk dogs... jsteele@writeme.com * http://www.gamecomputer.com/ssc/ */

« previous php.general (#3829) next »