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
相关文章
相关标签/搜索