jszip图像正在保存,但图像大小显示为零字节

时间:2017-07-26 10:16:51

标签: javascript

图像保存得当,但它们的大小为零字节,请帮我。

以下是代码:

$(function() {
    $(document).on('click', '#submitId', function() {
        var zip = new JSZip();
        var file = $('#pan')[0].files[0];
        zip.file($('#pan')[0].files[0].name, getBase64(file), {
            base64 : true
        });
        zip.generateAsync({
            type : "blob"
        }).then(function(content) {
            var fd = new FormData();
            fd.append('file1', content);
            $.ajax({
                type : 'POST',
                url : 'URL',
                data : fd,
                processData : false,
                contentType : false
                }).done(function(data) {
                console.log(data);
            });
        });
    });
});

0 个答案:

没有答案