ibanez270dx Posted June 25, 2008 Share Posted June 25, 2008 Hello, I have an application written in PHP that is used to securely share files, etc... however, I would like to prompt a download box when a user clicks to download a file. Currently, if the file is an accepted MIME type like .xls, .csv, .jpg, .gif, etc... it just opens the file in the browser or in the appropriate application. Is there a way I can force a download prompt? Thanks, - Jeff Quote Link to comment https://forums.phpfreaks.com/topic/111924-forcing-a-download-prompt-for-an-accepted-mime-type/ Share on other sites More sharing options...
hitman6003 Posted June 25, 2008 Share Posted June 25, 2008 pass an attachment content-disposition header... header('Content-Disposition: attachment; filename="downloaded.pdf"'); Quote Link to comment https://forums.phpfreaks.com/topic/111924-forcing-a-download-prompt-for-an-accepted-mime-type/#findComment-574480 Share on other sites More sharing options...
ibanez270dx Posted June 25, 2008 Author Share Posted June 25, 2008 thanks! I got it. Just in case anyone is having trouble with this: header("Content-Disposition: attachment; filename=\"$item_location\""); header("Content-Type: text/html"); readfile("$item_url"); Thanks again, - Jeff Quote Link to comment https://forums.phpfreaks.com/topic/111924-forcing-a-download-prompt-for-an-accepted-mime-type/#findComment-574502 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.