后臺是用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) { });? ? }
用formData上傳圖片
慕俠8885196
2017-06-13 18:15:08