ranslobo's avatar

Upload file "FileNotFoundException"

mac, valet, new laravel 5.4 install

I keep getting FileNotFoundException. i even tried to change permission to 777 on storage directory.... help please

web.php

Route::get('/', function () {
    return view('welcome');
});

Route::post('upload', function () {
    $file = request()->file('photo')->store('photos');
    return back();
});

welcome.blade.php

<form method="POST" action="/upload" enctype="multipart/form-data">
       {{ csrf_field() }}
        <input type="file" name="photo"></input>
        <button type="sumbit">upload</button>
</form>
0 likes
4 replies
rob897's avatar

I would die and dump

dd(request()) ;

and see if your getting the file in the request

ranslobo's avatar

Yea, I do get the file (instance of UploadedFile)

rob897's avatar
rob897
Best Answer
Level 30

I just tried this on my valet, no issues with your code. Did you chmod -R 777 on the storage dir?

ranslobo's avatar

I tried the same code in Homestead and it works so i guess it has to be something related to permissions..

Thanks

Please or to participate in this conversation.