1
我正在使用jquery fileupload来处理asp.net mvc的项目。 其工作正常,但只有一个问题是,在选择文件后,文件名不显示,仍然显示'没有选择文件'。如何在'没有选择文件'的地方显示文件名。我使用data.files [0] .name获得了文件名,但是如何显示,我使用usinf输入类型是文件控制。如何在jquery文件上传中显示名为'No file selected'的细节
我的控制是
<input type="file" id="ItemImages" accept="image/*" name="uploadfile" data-val="true" data-val-required="please select a file" class="fileupload-new">
和我的代码是
$('imffileuplod').fileupload({
dataType: 'json',
dropZone: null,
url: DomainName + "BackOffice/" + MethodName,
progressInterval: 10,
bitrateInterval: 50,
add: function (e, data) {
try {
var imageKbytes = parseFloat(data.files[0].size/1024);
var ImageMbytes = parseFloat(imageKbytes)/1024;
if (ImageMbytes > parseFloat(2.0)) {
$("#errormessage").text("Please upload image upto 2 MB only");
return;
}
alert(data.files[0].name);
$("#errormessage").text("");
$('#progress .bar').text('');
$('#progress .bar').css('width', '0%');
$('#progress .bar').show();
data.submit();
}
catch (ex) {
OpenAlertDialog(ex.message);
}
},
done: function (e, data) {
$('#progress .bar').css("width", "100%");
$('#progress .bar').text('100%');
$("#" + ImageSrcId).attr("src", data.result);
setTimeout(function() {
$('#progress .bar').css("width", "0%");
$('#progress .bar').text('');
}, 3000);
// $("#ProgressSpan").text('');
},
Fail: function (e) {
}
});
}
选择imaage它仍然显示 '未选择文件' 后
我正在使用jquery 1.8.3 –
–