0

I am using laravel with voyager as the admin panel. I am trying to upload a video through voyager media picker with file size 3GB but every time I do so I get the following message:

File is too big (3015.93MiB). Max filesize: 256MiB.

I changed the upload_max_filesize & post_max_size both to 4G But I still get the same issue.

I tried adding the following lines to .htaccess

php_value upload_max_filesize 4G

php_value post_max_size 4G

Still same issue

I tried amending the php.ini file found in vendor/laravel/sail/runtimes/7.4/php.ini and vendor/laravel/sail/runtimes/8.0/php.ini to the following:

[PHP]
upload_max_filesize = 4G

post_max_size = 4G
variables_order = EGPCS

Still I get the same issue.

I have also created a new file in the public_html directory called .user.ini and here is the content of the file:

upload_max_filesize = 4G

post_max_size = 4G

I still get the same issue.

I am really stuck and have no idea what to do, does anyone have any idea on how to solve this issue?

Omar Osama
  • 23
  • 5
  • Try changing the values to `M` instead of `G` ,`4000M` instead of `4G` and restart your server – Tithira Jul 05 '21 at 03:16
  • Same issue. I furthered my research on how to increase the limit, I found out that there is a dropzone-js file which has a default 256MiB file size upload. But the problem is that I have no idea where to find this file. I searched over all my files but unfortunately I found nothing. – Omar Osama Jul 05 '21 at 11:59

2 Answers2

2

There are a few things that you need to do:

PHP changes

First, you will need to increase the size of the file upload in the PHP configuration file. You can do this by editing the php.ini file and changing the upload_max_filesize and post_max_size values.

If you don't know where your php.ini file is located, you can create a new file called info.php and add the following code:

<?php
phpinfo();

Then, you can access the info.php file in your browser and it will show you the location of your php.ini file.

After you have increased the size of the file upload in the PHP configuration file, you will need to restart your web server. And then visit the info.php file again to make sure that the changes have been applied.

Dropzone.js changes

The Laravel Voyager Media Manager uses the Dropzone.js library to handle the file upload. So, you will need to increase the size of the file upload in the Dropzone definition.

The default size of the file upload in the Laravel Voyager Media Manager is 256MB.

For this, we will copy the media manager view file from the Laravel Voyager package to our project. You can do this by running the following command:

  • Create the resources/views/vendor/voyager/media directory if it doesn't exist:
mkdir -p resources/views/vendor/voyager/media
  • Copy the manager.blade.php file from the Laravel Voyager package to our project:
cp vendor/tcg/voyager/resources/views/media/manager.blade.php resources/views/vendor/voyager/media/manager.blade.php

Now, you can open the resources/views/vendor/voyager/media/manager.blade.php file and set the maxFilesize value to the desired size.

  • Open the file and go to line 847:
nano +847 resources/views/vendor/voyager/media/manager.blade.php

And inside the dropzone function add a new line and set the maxFilesize value to the desired size:

...
            dropzone.dropzone({
                // Add the line below
                maxFilesize: 500,
                timeout: 180000,
                url: '{{ route('voyager.media.upload') }}',
...

Save the file and you are done. After that go to the media manager page and do a hard refresh to make sure that the cache is cleared and try to upload a file that is larger than the default size.

Source

Bobby Iliev
  • 151
  • 2
  • 11
0

Since this has not been answered yet, i will share some knowledge for future reference for others.

There are a few factors need to consider.

  1. Check your server configs if it allows 4000M of upload (you can test normal file uploading) before proceeding to test the dropzone.js

As some servers (eg: nginx or others) has default values as well, hence they could also be limiting you from uploading large file sizes.

  1. Change the uploading limit values php.ini (which seems that you've done it).
  2. Check the dropzone.js settings in assets folder, as dropzone it has its own configurations.

Do check a possible answer here: Dropzone.js - maxFilesize increase not working

  1. Make sure to increase timeout to few mins on all of the above.

Default timeout is 30sec, which is not enough time if you dont have super fast internet, so need to increase timeout settings for your server, php and also dropzone.js.

Lastly, if all fails, you need to Inspect Element your network when you upload, it should give you an idea what the error is to overcome it.