below is my function to get file from my server writing in sailsJS.
When i try run this function, my console throw me this type of error:
TypeError: The header content contains invalid characters
In postman i send file in pdf format,
How content-type should look here?
fn: async function ({ id }, exits) {
this.res.set('Content-disposition', `attachment; filename=${id}`, 'content-type', 'application/pdf')//here
this.res.set('Access-Control-Allow-Origin', '*')
const localPath = path.join(sails.config.custom.uploadDirectory, id)
this.res.sendFile(localPath);
}
and how to open fle in a browser instead of download him to desktop?
thanks in advance