Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

david001's avatar

exceeds your upload_max_filesize ini directive (limit is 2048 KiB)

Hi, I am using mac and xampp server. I want to upload the audio of size 4.3mb, when I uploaded, i go error The file "bensound.mp3" exceeds your upload_max_filesize in the directive (limit is 2048 KiB).

I made changes in php.ini file, started my server and computer and tried again but still, I am getting the same error

; Maximum size of POST data that PHP will accept. post_max_size = 30M

; Maximum allowed size for uploaded files. upload_max_filesize = 30M

my routes



Route::get('audios','FrontendController@audio');
Route::post('audios','FrontendController@postaudio')->name('audio');

controller:


    public function postaudio(Request $request){
        $imageName = time().'.'.$request->audio->getClientOriginalExtension();
        $request->image->move(public_path('audio'), $imageName);
        
        return "uploaded";
    }

form:


@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-12">
            <div class="card">
                <div class="card-header">Album</div>

                <div class="card-body">
                    <form action="{{route('audio')}}" method="post" enctype="multipart/form-data">@csrf
                        <input type="file" name="audio" class="form-control" required="">


                        <button type="submit" class="btn btn-primary">Submit</button>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection

How can i solve this error? Any suggestion?

0 likes
2 replies
jlrdw's avatar

Should be able to increase that in your php.ini file.

willvincent's avatar

Possible you updated the wrong php.ini file, create a route that returns phpinfo() so you can see what the active config really is. I've also seen issues with file size limits come from nginx, if you happen to be running it.. but an error that explicitly references upload_max_filesize does sound like a php config issue.

Verify your php.ini changes are in place, etc by looking at the output of phpinfo, best way to know for sure what's going on under the hood.

Please or to participate in this conversation.