Code for downloading file based on "attachment" header