📜  在 jquery 中上传文件 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:05.543000             🧑  作者: Mango

代码示例1
$(function(){
    $('#uploadBTN').on('click', function(){ 
        var fd = new FormData($("#fileinfo"));
        //fd.append("CustomField", "This is some extra data");
        $.ajax({
            url: 'upload.php',  
            type: 'POST',
            data: fd,
            success:function(data){
                $('#output').html(data);
            },
            cache: false,
            contentType: false,
            processData: false
        });
    });
});