[英]which client side js library can I use for file upload where file size can be restricted
我可以使用哪个js库从任何浏览器上传文件,并允许客户端限制文件大小
dropzone.js can. dropzone.js可以。 dropzone website their example:
dropzone网站的示例:
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 jquery File Uploader 试用jquery文件上传器
it has option 它有选择
maxFileSize
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.
类型:整数默认值:undefined示例:10000000 // 10 MB注意:此选项仅对支持File API的浏览器有效。
But old browsers don't support this feature. 但是旧的浏览器不支持此功能。 And unlikely there are any way to fix it
而且不太可能有任何方法来解决它
尝试https://github.com/mailru/FileAPI我们在我们的Web项目中使用该库,在除android默认浏览器以外的任何浏览器中均可正常运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.