Frage

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

War es hilfreich?

Lösung 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

Andere Tipps

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top