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

MattB's avatar
Level 2

File Upload Limit Issues

I have a form which is used to upload a .zip file to my server. I can upload smaller ones (~200mb), but when I go to upload larger ones (nearer or above 1GB), the page will redirect from the upload form to the page showing the uploads, but the file I just uploaded doesn't show, nor does it make it to the database. I was having actual messages when I first started saying the post was too large but I changed 2 files as below and now there's no error, just nothing uploads. Where did I go wrong?

php.ini which is in the same folder as .htaccess:

post_max_size=2048M
upload_max_filesize=2048M

Also, in the .htaccess file, I added this:

php_value post_max_size 2048M;
php_value upload_max_filesize 2048M;
    
php_value client_max_body_size 2048M;
php_value client_body_buffer_size 2048M;

I would really appreciate your help with this one.

0 likes
7 replies
Talinon's avatar

@mattb

Perhaps check your max_input_time and max_execution_time settings. If you are uploading large files, it would stand to reason it would take a longer time.

MattB's avatar
Level 2

Are these in the php.ini file too? It doesn't seem to even try uploading the larger files. When I click upload it more or less instantly switches to the uploaded files page

Talinon's avatar

@mattb

Yes, within the php.ini file.

No errors? Nothing in the laravel log? What about the web server log?

You could also try bumping the memory_limit a bit higher than the default. To my understanding this shouldn't really affect file uploads because they shouldn't be fully stored in memory, but rather in chunks as it stores to the disk.. but worth trying.

MattB's avatar
Level 2

No nothing in storage/logs and nothing obvious in the server logs either

I have the memory limit already at it's max which is 512mb

Talinon's avatar

@mattb

Do you have a maximum size rule in the form validation? Perhaps failed validation is causing a redirect and you're not outputting the errors to the page?

MattB's avatar
Level 2

Nope all I have is this:

public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            //
            'image'       => 'required',
            'name'        => 'required',
            'description' => 'required',
            'price'       => 'required',
        ];
    }

Confused to heck with this one

Cronix's avatar

What webserver are you using? There are additional settings on that level in addition to just php. You'll also want to look at your web server logs for info, not just laravel/php logs.

There are also php time settings which are applicable. The larger the file, the longer it takes to upload so php needs to be kept alive longer before killing it. Default for php processing is 30 seconds. If your upload doesn't complete within that time, it just cuts it off.

max_input_time
max_execution_time

Your webserver settings should match your new php settings, or slightly exceed them.

Please or to participate in this conversation.