Question

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

Était-ce utile?

La solution 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

Autres conseils

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top