Mamerto Posted December 3, 2011 Share Posted December 3, 2011 Hi all, I am dealing with an html page in which a dynamically created PNG image is shown with: <img src="createchart.php"> The problem arises when users try to download the image since the default name that appears is just "createchart.php". Is there any way to make the browser suggest something like "chart.png"? Than you guys for your help, Mam Quote Link to comment https://forums.phpfreaks.com/topic/252369-change-name-of-image/ Share on other sites More sharing options...
sunfighter Posted December 3, 2011 Share Posted December 3, 2011 Are you sure createchart.php is an image and not a php file? rename is a simple php command that will take care of things like renaming a file. Quote Link to comment https://forums.phpfreaks.com/topic/252369-change-name-of-image/#findComment-1293926 Share on other sites More sharing options...
scootstah Posted December 3, 2011 Share Posted December 3, 2011 You need to add a header to the createchart.php file. header('Content-Disposition: attachment; filename=image.png'); Change "image.png" to whatever you want it to be. Quote Link to comment https://forums.phpfreaks.com/topic/252369-change-name-of-image/#findComment-1293930 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.