目前已经解决
createImageUploadDialog: function() {
var fileInput = this.fileInput;
if (this.needInit) {
this.needInit = false;
fileInput = $('<input type="file" name="ime-images" multiple="true"></input>');
fileInput.on("change", this.onChangeUploadFile.bind(this));
this.fileInput = fileInput[0];
// fileInput = document.createElement('input');
// fileInput.type = 'file';
// fileInput.name = 'ime-images';
// fileInput.multiple = true;
// fileInput.onchange = this.onChangeUploadFile.bind(this);
// this.fileInput = fileInput;
}
fileInput.click();
}如有问题 请大神指教
不能选择同一张是因为input 已经有同一个file文件了,只需要把input的值清空即可。
createImageUploadDialog: function() {
var fileInput = this.fileInput;
if (!fileInput) {
fileInput = document.createElement('input');
fileInput.type = 'file';
fileInput.name = 'ime-images';
fileInput.multiple = true;
fileInput.onchange = this.onChangeUploadFile.bind(this);
this.fileInput = fileInput;
}
fileInput.value = ''; //这里清空input的值,即可解决选择同一文件无法触发回调的问题
fileInput.click();
}
回复
$("#fileinput").fileinput({
uploadUrl: '/user/upload_img', // you must set a valid URL here else you will get an error
language: 'zh',
allowedFileExtensions: ['jpg', 'png', 'gif'],
overwriteInitial: false,
maxFileSize: 10000,
maxFilesNum: 3,
minFileCount: 1,
showCaption: false,
ZoneEnabled: false,
browseClass: "btn btn-danger",
enctype: 'multipart/form-data'
});
回复
$("#fileinput").fileinput({
uploadUrl: '/user/upload_img', // you must set a valid URL here else you will get an error
language: 'zh',
allowedFileExtensions: ['jpg', 'png', 'gif'],
overwriteInitial: false,
maxFileSize: 10000,
maxFilesNum: 3,
minFileCount: 1,
showCaption: false,
ZoneEnabled: false,
browseClass: "btn btn-danger",
enctype: 'multipart/form-data'
});
$("#fileinput").fileinput({
uploadUrl: '/user/upload_img', // you must set a valid URL here else you will get an error
language: 'zh',
allowedFileExtensions: ['jpg', 'png', 'gif'],
overwriteInitial: false,
maxFileSize: 10000,
maxFilesNum: 3,
minFileCount: 1,
showCaption: false,
ZoneEnabled: false,
browseClass: "btn btn-danger",
enctype: 'multipart/form-data'
});