Re: fopen

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Oct 26, 2005, at 12:54 AM, John Taylor-Johnston wrote:

It does what I want, but I worry 4096 may not be big enough. Possible? Is there a way to detect the filesize and insert a value for 4096?
$buffer = fgets($dataFile, $filesize);
Is this what it is for?
John


<?php
#http://ca3.php.net/fopen
$filename = "/var/www/html2/assets/about.htm" ;
$dataFile = fopen( $filename, "r" ) ;
  while (!feof($dataFile))
  {
      $buffer = fgets($dataFile, 4096);
      echo $buffer;
  }
$sql = "insert into table ... $buffer";
?>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



fgets

(PHP 3, PHP 4, PHP 5)

fgets -- Gets line from file pointer
Description

string fgets ( resource handle [, int length] )

Returns a string of up to length - 1 bytes read from the file pointed to by handle. Reading ends when length - 1 bytes have been read, on a newline (which is included in the return value), or on EOF (whichever comes first). If no length is specified, the length defaults to 1k, or 1024 bytes.

If an error occurs, returns FALSE.

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux