RE: [PHP-WIN] PHP and Filesystem

From: Date: Thu, 29 Mar 2001 05:30:48 +0000
Subject: RE: [PHP-WIN] PHP and Filesystem
Groups: php.windows 
Request: Send a blank email to php-windows+get-6362@lists.php.net to get a copy of this message
According to what I understand of fgets() it will read the first 4096 bits of information and leave the rest behind. So your pics will come out corrupt if they are larger than 4096 bit. (Well at least I think it's bits. But then it might be bytes) So all you have to do is make that number large enough to take the whole pic. > ---------- > From: Thomas W. Badera[SMTP:twb@vonx.com] > Sent: Wednesday, March 28, 2001 6:20 PM > To: php-windows@lists.php.net > Subject: [PHP-WIN] PHP and Filesystem > > Another question.... > > I've got a script that is supposed to read URLs out of a text file, open > the > image at the URL, then copy it to the local computer. The code follows: > > <?php > > $input = fopen("d:\\webs\\sportspotonline.com\\data\\images.txt", "r"); > while (!feof($input)) > { > $buffer = trim(fgets($input, 4096)); > if ($buffer != "Navigation") > { > $fnArray = explode("/", $buffer); > $fn = $fnArray[sizeof($fnArray)-1]; > $fn = "d:\\webs\\sportspotonline.com\\data\\images\\".$fn; > $output = fopen($fn, "wb"); > $grab = fopen($buffer, "rb"); > while ($grabbed = fread($grab, 4096);) > { > $grabbed = stripslashes($grabbed); > fwrite($output, $grabbed, strlen($grabbed)); > } > fclose($output); > fclose($grab); > } > } > fclose($input); > > ?> > > The images this saves are all corrupt.... openable, partially viewable, > but > corrupt. Any idea? > > --TWB > > > --- > Thomas W. Badera > WebTeam Manager > Clarkson University > < baderatw@clarkson.edu > > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net > For additional commands, e-mail: php-windows-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.windows (#6362) next »