When I am downloading the image from my website using this code it is showing me that image is damaged, but same code is working fine on other domains.
Error when I am downloading the image
Why is this code not working on my domain?
This code defines how we can download the images in the browser:
<?php
header( 'Pragma: public' );
header( 'Expires: 0' );
header( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' );
header( 'Cache-Control: private', false );
header( 'Content-Description:File Transfer' );
header($_SERVER['SERVER_PROTOCOL'].' 200 OK');
header( 'Content-Type: image/png');
header( 'Content-Disposition: attachment; filename="header.jpg";' );
header( 'Content-Transfer-Encoding: binary' );
header( 'Content-Length: ' . filesize("images/header.jpg") );
readfile("http://iqet.com/images/header.jpg");
?>
You can try this code, it will work: