I can get the raw data of the file that I am requesting, but I can't get the browser to serve the file to the user. Do I need to use iframes?
//Client code
download_file: function (path, callback) {
$http.post('/download/client_file', {path:path}).
success(function(data, status, headers, config) {
console.log(data); //this contains the raw data of the res.download
//from the server.
});
}
//server code
res.download(file); // the path is proper
I used the code below in my services file for downloading items and it worked great. I got it from http://filamentgroup.com/lab/jquery_plugin_for_requesting_ajax_like_file_downloads/
$('<form action="'+ url +'" method="'+ ('post') +'">'+inputs+'</form>')
.appendTo('body').submit().remove();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With