By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
rocoderesrocoderes
  • Home
  • HTML & CSS
    • Login and Registration Form
    • Card Design
    • Loader
  • JavaScript
  • Python
  • Internet
  • Landing Pages
  • Tools
    • Google Drive Direct Download Link Generator
    • Word Count
  • Games
    • House Painter
Notification Show More
Latest News
How to set the dropdown value by clicking on a table row
Javascript – How to set the dropdown value by clicking on a table row
JavaScript
Attempting to increase the counter, when the object's tag exist
Javascript – Attempting to increase the counter, when the object’s tag exist
JavaScript
Cycle2 JS center active slide
Javascript – Cycle2 JS center active slide
JavaScript
Can import all THREE.js post processing modules as ES6 modules except OutputPass
Javascript – Can import all THREE.js post processing modules as ES6 modules except OutputPass
JavaScript
How to return closest match for an array in Google Sheets Appscript
Javascript – How to return closest match for an array in Google Sheets Appscript
JavaScript
Aa
Aa
rocoderesrocoderes
Search
  • Home
  • HTML & CSS
    • Login and Registration Form
    • Card Design
    • Loader
  • JavaScript
  • Python
  • Internet
  • Landing Pages
  • Tools
    • Google Drive Direct Download Link Generator
    • Word Count
  • Games
    • House Painter
Follow US
High Quality Design Resources for Free.
rocoderes > JavaScript > Javascript – Changing the default max filesize in Dropzone.js
JavaScript

Javascript – Changing the default max filesize in Dropzone.js

Admin
Last updated: 2024/02/10 at 2:59 PM
Admin
Share
2 Min Read
Changing the default max filesize in Dropzone.js

Problem:

I am trying to use Dropzone.js with Flask to allow larger files to be uploaded, but I am struggling to change the 256MB default max file size.

Contents
Problem:Solution:

At first I thought this was the Flask default, so I tried to change it via something like: app.config[‘MAX_CONTENT_LENGTH’] = 1024 * 1024 * 1024 * 50

This didn’t work, so my next presumption is that it is the javascript framework default. So I am trying to change that via maxFilesize – I’ve read quite a few posts online on various sites to try to determine what I am doing wrong.

<html>
  <head>
    <title>File Upload</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.9.3/min/dropzone.min.css">
  </head>
  <body>
    <h1>File Upload</h1>
    <form action="{{ url_for('upload_files') }}" class="dropzone">
    </form>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.9.3/min/dropzone.min.js"></script>
    <script type="text/javascript">
        dropzone.options.uploadWidget = {
          maxFilesize:100000
        }</script>
  </body>

I initially changed the default in Flask via app.config[‘MAX_CONTENT_LENGTH’], then I tried to change it in javascript

Solution:

Check out the dropzone config

According to there the syntax should be

<script>
  // Note that the name "myDropzone" is the camelized
  // id of the form.
  Dropzone.options.myDropzone = {
    // Configuration options go here
  };
</script>
<form action="/target" class="dropzone" id="my-dropzone"></form>

In your case you seem to be missing the id id="upload-widget" and dropzone should be Dropzone

<form action="{{ url_for('upload_files') }}" class="dropzone" id="upload-widget"></form>
<script>
// maxFilesize is in MiB
Dropzone.options.uploadWidget = {
    maxFilesize: 100000
}
</script>

Related

Subscribe to Our Newsletter

Subscribe to our newsletter to get our newest articles instantly!

Share this Article
Facebook Twitter Email Print
What do you think?
Love0
Sad0
Happy0
Sleepy0
Angry0
Dead0
Wink0
Previous Article How to set the value of two dropdowns by clicking on a table row? Javascript – How to set the value of two dropdowns by clicking on a table row?
Next Article How can I change rowsPerPage in MaterialReactTable? Javascript – How can I change rowsPerPage in MaterialReactTable?
Leave a comment Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

- Advertisement -

You Might Also Like

How to set the dropdown value by clicking on a table row

Javascript – How to set the dropdown value by clicking on a table row

February 11, 2024
Attempting to increase the counter, when the object's tag exist

Javascript – Attempting to increase the counter, when the object’s tag exist

February 11, 2024
Cycle2 JS center active slide

Javascript – Cycle2 JS center active slide

February 10, 2024
Can import all THREE.js post processing modules as ES6 modules except OutputPass

Javascript – Can import all THREE.js post processing modules as ES6 modules except OutputPass

February 10, 2024
rocoderesrocoderes
Follow US

Copyright © 2022 All Right Reserved By Rocoderes

  • Home
  • About us
  • Contact us
  • Disclaimer
Join Us!

Subscribe to our newsletter and never miss our latest news, podcasts etc.

Zero spam, Unsubscribe at any time.
Welcome Back!

Sign in to your account

Lost your password?