mardi 5 septembre 2017

Uploading a file onto Laravel \app\file directory

I want to upload a file into one of my directories. If the user uploads a file, I would like to upload it to a 'file' directory I created in the \app directory. My form looks like:

<form class="form-horizontal" method="POST" action="/results" enctype="multipart/form-data" files=true>
   <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
   <input type='file' name='pic'>
   <input type="submit">
</form>

And my routes are as such:

Route::post('/results', function(){
    $x=\Illuminate\Support\Facades\Request::except('_token');
    $x['pic']->move('my_webpage/app/files');
    dd($x['pic']);
});

Now when I move it the error I receive is: "Unable to create the "https//my_webpage/app/files" directory"

Could anyone please guide me in the proper way on how to upload files in Laravel 5.0 correctly



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire