rachelk Posted September 21, 2009 Share Posted September 21, 2009 Is there a way to have a link open up a dialogue box for the user to save a particular image to their computer, instead of them having to right click and save it? Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/174954-link-to-download-image/ Share on other sites More sharing options...
redarrow Posted September 21, 2009 Share Posted September 21, 2009 read this if any good <?php if (file_exists($file) ) { header('Content-type: application/force-download'); header('Content-Transfer-Encoding: Binary'); header('Content-length: '.filesize($file)); header('Content-disposition: attachment; filename='.basename($file)); readfile($file); } else { echo 'No file with this name for download.'; ?> Link to comment https://forums.phpfreaks.com/topic/174954-link-to-download-image/#findComment-922056 Share on other sites More sharing options...
rachelk Posted September 21, 2009 Author Share Posted September 21, 2009 Thanks for your help. I'm not familiar with php so I don't know how I would go about using that code to create the link.. Link to comment https://forums.phpfreaks.com/topic/174954-link-to-download-image/#findComment-922065 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.