笔记 - a502781464/Simple-Ajax-Uploader GitHub Wiki

Image size is less than 2 MB
(image format support jpg,jpeg,png)

var uploader = new ss.SimpleUpload({ button: 'uploadDriveLicenceButton', // file upload button url: '/CustomerService/uploadDriveLicence', // server side handler name: 'driveLicence', // upload parameter name responseType: 'json', method: 'POST', allowedExtensions: ['jpg', 'jpeg', 'png'], customHeaders: {'X-CSRF-Token': $token}, maxSize: 2048, // kilobytes onSubmit: function(filename, ext) { $('#driveLicence-small-img').html('

Uploading...

'); }, onSizeError: function() { ui.warning('Image size is less than 2 MB'); }, onExtError: function() { ui.warning('image format support jpg,jpeg,png'); }, onComplete: function (filename, response) { if (!response) { alert(filename + 'upload failed'); return false; } img = response.file; $('#driveLicence').val(img).next().remove(); $('#driveLicence-small-img').html(''); } });
⚠️ **GitHub.com Fallback** ⚠️