hi. i want to load and read a file in php. i wrotte this code but it doesn't work.
i want when the user loads a txt file, then it will be shown in the page. i can use fopen but i dont know its directory for example. any help ?
<input type="file" name="doc" />
$file = fopen($_FILES['doc'], "r") or exit("Unable to open file!");
//Output a line of the file until the end is reached
while(!feof($file))
{
echo fgets($file). "<br>";
}
fclose($file);
?>