You may want to add the following line just after '<?php' so as to set the script execution timeout to one hour instead of the default 30 seconds... set_time_limit( 3600 ); // Set script timeout to 1 hour HTH, Madruga -----Original Message----- From: Fernando Madruga [mailto:[EMAIL PROTECTED]] Sent: quinta-feira, 29 de Março de 2001 13:39 To: Thomas W. Badera; [EMAIL PROTECTED] Subject: RE: [PHP-WIN] PHP and Filesystem - Solution Some lines were wrapped on my previous msg; this one fixes that, so you can simply copy/paste the block of code into a file... Bye, Madruga -----Original Message----- From: Fernando Madruga [mailto:[EMAIL PROTECTED]] Sent: quinta-feira, 29 de Março de 2001 13:34 To: Thomas W. Badera; [EMAIL PROTECTED] Subject: RE: [PHP-WIN] PHP and Filesystem - Solution First, if you're trying to get just the name of a file in a url, use basename(). Then remove stripslahes as it corrupts binary data. This would result in the following code that I've *TESTED* with some image urls and modified to print a nicely formated progress; I've also renamed some variables... <?php // replace with your own path (DON'T END WITH SLASHES!!) $basepath = "d:\\lix"; $flist = fopen( "$basepath\\images.txt", "r" ) or die( "Unable to find images.txt!\n" ); while( !feof( $flist ) ) { $url = trim( fgets( $flist, 4096 ) ); // I don't know WHY you would want to compare $url to 'Navigation', but I've // kept it. If it's not needed, replace the 'if' line with the following: // if ( $url ) { // ignore empty lines... if ( $url && $url != "Navigation" ) { $fn = "$basepath\\images\\" . basename( $url ); echo "Copying $url\n => $fn\n "; $foutput = fopen( $fn, "wb" ); $fgrab = fopen( $url, "rb" ); // "r" also seems to work... $kb = 0; while( !feof($fgrab) ) { $grabbed = fread( $fgrab, 1024 ); $kb++; if ( ( $kb % 10 ) == 0 ) { echo "*"; // write an asterisk for every 10 KB grabbed... } else { echo "."; // write a dot for each KB grabbed... }; fwrite( $foutput, $grabbed, strlen( $grabbed ) ); }; echo "\n"; // ready output for next url... fclose( $foutput ); fclose( $fgrab ); }; }; fclose( $flist ); ?> -----Original Message----- From: Thomas W. Badera [mailto:[EMAIL PROTECTED]] Sent: quarta-feira, 28 de Março de 2001 17:20 To: [EMAIL PROTECTED] 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 < [EMAIL PROTECTED] > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]