This is my code to generate a zip file; I am unable to upload a .zip
file to server, displaying error like [[Promise]] is not a file:
var zip = new JSZip();
zip.file("Hello.txt", "Hello World\n");
/*create a folder*/
var img = zip.folder("images");
/*create a file in images folder*/
img.file("Hello1.txt", "Hello111 World\n");
/* generate the zip file */
var content = zip.generateAsync({type:"blob"});
This is the code I tried to upload the zip file but got no response.
var fd = new FormData();
fd.append('fileZip', content);
$.ajax({
data: fd,
url: '/plan-upload/1',
type: 'POST',
processData: false,
contentType: false,
success: function(response) {
alert("success"); /*$('#text-us').modal('toggle');*/
}
});
Now, can we upload this generated zip file to server? If yes, how? If no, why?