The mysql implementation I've got does not allow the local load data infile. so I've been trying to work with php's fopen and fget commands to see if I can eventually post data to my database that way.
the code I'm using just as a functionality test even before the sql interface is:
<?php
$filename = $_FILES['userfile']['tmp_name'];
$handle = fopen($filename, "rbt");
while (!feof($handle)) {
$buffer = fgets($handle);
echo $buffer . "<br>";
}
fclose($handle);
?>
Now this works just fine for small files txt files. However, when I try and upload a file with 4875kb (small for the data I actually want to import) I start getting the following errors looping over and over ( I assume for each line of the file):
Warning: feof(): supplied argument is not a valid stream resource in /home/domains/cintiva.com/web/number.php on line 6
Warning: fgets(): supplied argument is not a valid stream resource in /home/domains/cintiva.com/web/number.php on line 7
Any insights into why this is happening would be greatly appreciated. It seems to me that it trys running the while loop before the file is even finished loading, and thus has nothing to work with.....