jQuery Ajax文件上傳 - jQuery Ajax File Upload

問題:

Can I use the following jQuery code to perform file upload using POST method of an ajax request ? 我可使用如下jQuery代碼使用ajax請求的POST方法執行文件上傳嗎? ajax

$.ajax({
    type: "POST",
    timeout: 50000,
    url: url,
    data: dataString,
    success: function (data) {
        alert('success');
        return false;
    }
});

If it is possible, do I need to fill data part? 若是有可能,我是否須要填寫data部分? Is it the correct way? 這是正確的方法嗎? I only POST the file to the server side. 我只將文件發佈到服務器端。 服務器

I have been googling around, but what I found was a plugin while in my plan I do not want to use it. 我一直在搜索,可是我發現是一個插件,而在個人計劃中我不想使用它。 At least for the moment. 至少目前是這樣。 ide


解決方案:

參考一: https://stackoom.com/question/9jYT/jQuery-Ajax文件上傳
參考二: https://oldbug.net/q/9jYT/jQuery-Ajax-File-Upload
相關文章
相關標籤/搜索