<input type="file" id="input-file-now" class="dropify" />
<button type="button" onclick="dropifyUpload()">上传</button>
<script>
function dropifyUpload() {
var formData = new FormData() //创建一个forData
formData.append('img', $('#input-file-now')[0].files[0]) //把file添加进去 name命名为img
$.ajax({
url: "https://localhost:5001/Store/OnPostUpload",
type: 'POST',
data: formData,
async: false,
cache: false,
contentType: false,
processData: false,
success: function (returndata) {
alert(returndata);
},
error: function (returndata) {
alert(returndata);
}
});
}
</script>
转载请保留http://www.luofenming.com/show.aspx?id=ART2020041400001