This is a discussion on feof() problem within the PHP General forums, part of the PHP Programming Forums category; Hi My Code : <?php $uploaddir = '/tmp'; print "<pre>"; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir . $_FILES['...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi My Code : <?php $uploaddir = '/tmp'; print "<pre>"; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir . $_FILES['userfile']['name'])) { print "File is valid, and was successfully uploaded. Here's some more debugging info:\n"; print_r($_FILES); $filename = $uploaddir . $FILES['userfile']['name'] ; $filehandle = fopen($filename,"r"); if(! $filehandle) { echo ("<br> file opening error </br>"); } else { echo (" file opened in read mode "); $count=0; ini_set('auto_detect_line_endings', true); while( (!feof($filehandle) ) && $count < 100 ) { $line = fgets($filehandle,4096); #$line = explode(":",fgets($filehandle,100) ) ; echo " line = " . $line ; #print_r($line); $count++; if($count > 90 ) echo " some problem "; echo ("<BR><BR>"); } fclose($filehandle); } } else { print "Possible file upload attack! Here's some debugging info:\n"; print_r($_FILES); } ?> The output that I am getting : File is valid, and was successfully uploaded. Here's some more debugging info: Array ( [userfile] => Array ( [name] => filename.txt [type] => text/plain [tmp_name] => /tmp/phpq8YmxN [error] => 0 [size] => 466 ) ) file opened in read mode line = line = line = # 90 lines then it is printing line = someproblem # ten lines My question is why it is going into infite loop ,what is problem with the above code. regards CVR __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com |
|
|||
|
On Tuesday 22 July 2003 14:44, chandrakant Reddy wrote:
[snip] > The output that I am getting : > > > File is valid, and was successfully uploaded. Here's > some more debugging info: > Array > ( > [userfile] => Array > ( > [name] => filename.txt > [type] => text/plain > [tmp_name] => /tmp/phpq8YmxN > [error] => 0 > [size] => 466 > ) ) > file opened in read mode line = > line = > line = > # 90 lines then it is printing > > line = someproblem > # ten lines > > > My question is why it is going into infite loop ,what > is problem with the above code. Could you explain what you mean by infi[ni]te loop? How is it manifesting itself? Is it printing the above non-stop? -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* It is much harder to find a job than to keep one. */ |