This is a PHP tutorial on how to download a file from a remote server using the code above, I am downloading a remote image and saving it as a local file on Hide Copy Code. $.ajax({ url:"download.php", method:"post", data:{fileName:fileName}, success:function(e){ alert(e); } }) Your code is sending I've seen many download scripts written in PHP, from simple one-liners to in many cases programmers simply copy the code from something that works, 22 Jan 2019 PHP provides ZipArchive Class which allows us to create Zip file. This class Completed Code