6ber6ou's avatar

Get a Local txt File Content

Hi All.

I have a info.txt file on my computer.

Must I upload the file, via a button, before get the content ? How can I get the content of this file ?

0 likes
2 replies
jwz104's avatar
try
{
    $contents = File::get($filename);
}
catch (Illuminate\Filesystem\FileNotFoundException $exception)
{
    die("The file doesn't exist");
}

This will read the content of a file. The file has to be on the server(If you host you laravel on your own pc it can read the file) else you have to upload it to the server.

simondavies's avatar

as @jwz104 has mentioned, if the file is on your PC desktop etc and not on the server then, you would need to use some upload script/input file to first get the file form your machine, in order for it to get read.

If you need help on this then just do a simple file upload search

Please or to participate in this conversation.