asked on
$fh = fopen('c:\myFile.txt', 'r') or die("Can't open file");
while readFile.eof=false
{
$fs = fread($fh,25000)
//Do my work on the 25 or less stream.
}
fclose($fh);
Thanks in advance
ASKER
$strFile = "c:\\myFile.doc";
$bufferSize = 25000;
$rndFileID = rndID();
$newFileSize = filesize($strFile);
if ($newFileSize % $bufferSize > 0)
{
$newFileSegments = $newFileSize /$bufferSize
}
else
{
$newFileSegments = ($newFileSize /$bufferSize) + 1
}
for (x=1;x<$newFileSegments;x++)
{
$data = file_get_contents($strFile, ,null ,x*$bufferSize, $bufferSize);
$file_put_contents ('c:\\copiedFile.doc', $data, FILE_APPEND);
}
PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.
TRUSTED BY
http://uk3.php.net/manual/en/function.file-get-contents.php