1

I'm using dropzone in uploading image, but I have a problem in maxFilesize of it, I put maxFilesize: 50 and according to it's document it is 50mb, but when I upload image that is more than 1mb it says that it's too large.

On my research I found a codepen, when I also try to make the maxFilesize: 50, upload a 2mb image and when I hover the image it also said that the image is too large.

Here is the sample of my code

$('#imageUploader').dropzone({
    paramName: 'file',
    maxFilesize: 50,
    acceptedFiles: "image/*",
    uploadMultiple: false,
    success: function( file, response ) {
      console.log(response);
    },
    error: function( file, errorMessage ) {
     console.log(errorMessage);
    },
    complete: function() {
      console.log('Complete');
    }
  });

I don't know if it's really a bug or I just missing something to my code

I have tried this link I added this one in my code

 init: function() {
  this.on("uploadprogress", function(file, progress) {
    console.log("File progress", progress);
  });
}

but still has an error

when I try to pass 1mb below the file path, filename,basename,pathname,realPath has a value but when I pass 4mb image it doesn't have a value

I'm using laravel for backend

MariaJen
  • 1,065
  • 1
  • 8
  • 17

2 Answers2

0

addedfile: function (file) {
            if (file.size > (1024 * 1024 * 5)) // not more than 5mb
            {
                this.removeFile(file);
                alert("Only 5 mb file size is allowed");
            }
        }
Qaiser Mehmood
  • 202
  • 2
  • 10
0

You'll need to do a few things to increase the size limits here, if you're using NGINX you'll need to add a directive similar to this in your config file:

client_max_body_size 100M;

and in your php.ini (if apache this is all you need to do)

upload_max_filesize = 100M
post_max_size = 100M
rattybag
  • 381
  • 2
  • 8