后台是用C#语言 ASP.Net MVC 写的,后台的借口要怎么获取formdata图文数据呢????
html代码:
<div class="input-group">
<span class="input-group-addon">
图片附件
</span>
<input type="text" class="form-control" id="txtEventFile" v-model="UploadFile" readonly="" placeholder="">
<span class="input-group-btn">
<button class="btn btn-default" type="button" id="">
<input type="file" name="file" id="btnEventFile" onchange="UpdateFile(this)" style="width: 100%; height: 100%; position: absolute; opacity: 0; left: 0; top: 0; ">
<i class="icon-camera"></i>
</button>
</span>
</div>
js代码:
var UpdateFile = function () {
var formData = new FormData();
formData.append('file', $('#btnEventFile').files[0]);
$.ajax({
url: '/upload/UpLoadFile',
type: 'POST',
cache: false,
data: formData,
processData: false,
contentType: false
}).done(function (res) {
}).fail(function (res) { });
}
GabrielMXY3782564