which client side js library can I use for file upload where file size can be restricted

StackOverflow https://stackoverflow.com/questions/22343616

  •  13-06-2023
  •  | 
  •  

سؤال

Which js library can I use to upload files from any browser and will allow client-side restriction of the file size

هل كانت مفيدة؟

المحلول 2

Try jquery File Uploader

it has option

maxFileSize

The maximum allowed file size in bytes.

Type: integer Default: undefined Example: 10000000 // 10 MB Note: This option has only an effect for browsers supporting the File API.

But old browsers don't support this feature. And unlikely there are any way to fix it

نصائح أخرى

dropzone.js can. dropzone website their example:

Dropzone.options.myAwesomeDropzone = {
  paramName: "file", // The name that will be used to transfer the file
  maxFilesize: 2, // MB
  accept: function(file, done) {
    if (file.name == "justinbieber.jpg") {
      done("Naha, you don't.");
    }
    else { done(); }
  }
};

Try https://github.com/mailru/FileAPI We using this library in our web projects, works fine in any browsers except android default browser.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top