dreamwest Posted November 1, 2009 Share Posted November 1, 2009 I have a local image im trying to send to the browser but nothing happens $path = "/home/user/public_html/ajax/test.jpg"; header('Content-type: image/jpg'); header("Content-Disposition: attachment; filename='{$path}'"); Quote Link to comment https://forums.phpfreaks.com/topic/179787-content-disposition-attachment/ Share on other sites More sharing options...
trq Posted November 1, 2009 Share Posted November 1, 2009 I have a local image im trying to send to the browser Define 'send to the browser'. Do you want it displayed in the browser? Or to prompt the user to save the file? Quote Link to comment https://forums.phpfreaks.com/topic/179787-content-disposition-attachment/#findComment-948528 Share on other sites More sharing options...
dreamwest Posted November 1, 2009 Author Share Posted November 1, 2009 Prompt user to download image Quote Link to comment https://forums.phpfreaks.com/topic/179787-content-disposition-attachment/#findComment-948529 Share on other sites More sharing options...
trq Posted November 1, 2009 Share Posted November 1, 2009 You never actually send any file in your code. <?php $path = "/home/user/public_html/ajax/test.jpg"; header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=".basename($path)); header("Content-Description: File Transfer"); readfile($path); ?> Quote Link to comment https://forums.phpfreaks.com/topic/179787-content-disposition-attachment/#findComment-948530 Share on other sites More sharing options...
dreamwest Posted November 1, 2009 Author Share Posted November 1, 2009 Thanks works well Quote Link to comment https://forums.phpfreaks.com/topic/179787-content-disposition-attachment/#findComment-948539 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.