Tuesday 9 May 2017

res.download() not working

My aim is to download files on browser window with res.download() and I am following this post.But file is not getting downloaded in the browser.In my console(grunt) it returns 200 response but noting happens on the front end. Controller:

$http.get('/api/knowledges/file_download/?filepath='+fileDownload.file_details.path).success(function(data){
            console.log("and the api returned success")
        });

Api:

res.download(req.query.filepath, 'my.pdf');

And this is the JSON which I am giving to the server:

fileDownload=  {
    destination:"server/uploads/docs"
    encoding:"7bit"
    fieldname:"file"
    filename:"9b129f186ca7c534dbfb90e6c2762226"
    mimetype:"application/pdf"
    originalname:"Dress Code.pdf"
    path:"server\uploads\docs\9b129f186ca7c534dbfb90e6c2762226"
    size:397860}



via Akshay

No comments:

Post a Comment