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}'"); 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? 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 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); ?> 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 Link to comment https://forums.phpfreaks.com/topic/179787-content-disposition-attachment/#findComment-948539 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.