trayan's avatar

Dropzone maxFileSize not working

Hello I implemented dropzone for my project as it is in "Build ProjectFlyer With Me" series.

I have a form:

<form action="{{ url("/hq/project/$project->id/bulk") }}" method="post" class="dropzone" id="addPhotosForm">
    {{ csrf_field() }}
</form>

At the bottom of the file I include:

<script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/4.3.0/dropzone.js"></script>
<script>
    Dropzone.options.addPhotosForm = {
        paramName: 'photo',
        acceptedFiles: '.jpg, .jpeg, .png',
        maxFileSize: 1,
    }
</script>

Option acceptedFiles is working but maxFileSize not. It allows me to upload file bigger than 1mb. Please, help..

0 likes
2 replies
noeldiaz's avatar
Level 23

@trayan Your code looks almost like some I have on a dropzone form. Only thing I see different is that the option for max filesize I have it like this:

maxFilesize: 2,

Without the capital S. Also I have:

enctype="multipart/form-data"

In my form element. I think you need that to make it work correctly?

1 like
trayan's avatar

maxFilesize was the problem.. what a stupid mistake I made.. thank you @noeldiaz

Please or to participate in this conversation.