Store multiple files - access denied

Posted 5 months ago by ziben69

Hello guys, I try to do multiupload files. I have model File:

class File extends Model
    protected $fillable = [

FileController (function storeFiles):

public function storeFiles(Request $request)

        $this->validate($request, [
            'filename' => 'required',
            'filename.*' => 'mimes:doc,pdf,docx,zip'

            foreach($request->file('filename') as $file)
                $file->move(public_path().'/files/', $name);  
                $data[] = $name;  

        $file = new File();
        $file->title = $request->input('title');
        $file->description = $request->input('description');

        return redirect()->action('[email protected]');

and form:

 <form action="{{ action ('[email protected]')}}" method="POST"
<input type="hidden" name="_token" value="{{csrf_token() }}"/>
<div class="form-group" style="position:relative">
         <input type="text" class="form-control" name="title" placeholder="Title" id="title" ><div id="headercount">255</div></span>
<div class="form-group" style="position:relative">
       <textarea class="form-control" rows="5" name="description" id="description"  placeholder="Description" maxlength="999" ></textarea>
<div class="form-group">
       <input type="file" id="filename" onchange="ValidateSize(this)" name="filename[]" multiple aria-describedby="fileHelp"/>

When I try to add a file, I get an error:

Prohibited access!
You do not have the right to access the desired directory. There is no index in the catalog or the catalog is protected against reading.

If you think this is a server error, please contact your administrator.

Error 403
Apache/2.4.33 (Win32) OpenSSL/1.1.0h PHP/7.2.6

I did:

php artisan storage:link

but it still doesn't work. Can you help me? Thanks.

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.