$ _FILE is empty when loading in PHP

I used dropzone.js to handle the loading part in the interface using jquery.

http://www.dropzonejs.com/

My test case:

Upload a 34 MB file. Works fine
Upload a 27 MB file. Works fine
Upload two files, each of them are 5 MB. Works fine
Upload two files, 34 MB + 27 MB. *Fail* , $_Files is an empty array

Here is the jquery code:

<script>
    $(document).ready(function () {
        Dropzone.options.myAwesomeDropzone = {
            autoProcessQueue: false,
            url: '<?= site_url("admin/video/upload"); ?>',
            addRemoveLinks: true,
            previewsContainer: ".dropzone-previews",
            uploadMultiple: true,
            parallelUploads: 50,
            maxFilesize: 500, //500MB
            acceptedFiles: 'video/*',
            maxFiles: 100,
            init: function () {
                var myDropzone = this;

                myDropzone.on("success", function (file, response) {
                    $("#success, #fail").hide();
                    $("#" + response).show();
                });

                myDropzone.on("maxfilesexceeded", function (file) {
                    this.removeFile(file);
                });

                $("#submit-all").click(function (e) {
                    e.preventDefault();
                    e.stopPropagation();
                    myDropzone.processQueue();
                });
            }
        }
    });
</script>

Here is the PHP code

public function upload() {
    die(var_dump($_FILES));
}

So why is $ _Files empty and how to fix it? Many thanks.

+4
source share
1 answer

34 MB + 27 MB = 61 MB

So you send 61MB.

The default values ​​for PHP are 2 MB for upload_max_filesize and 8 MB for post_max_size. Depending on your host, changing these two PHP variables can be done in several places, most likely php.ini or .htaccess (depending on your deployment situation)

Have you checked them in your php.ini?

Maximum allowed size for each uploaded file.

upload_max_filesize = 40M

upload_max_filesize, .

post_max_size = 40M

500 , 500 . , , post_max_size . , 500 , upload_max_filesize = 501M post_max_size = 1001M

+7

All Articles