Issue with displaying image png with php -
i have issue displaying image stored on debian server outside path accessible webserver in order keep safe. here's link expected results, relevant php code below:
header("content-type: image/png"); if (isset($_post['mot_de_passe']) , $_post['mot_de_passe'] == "superpassword") { // if password valid $filename = "/home/image/test.png"; $handle = fopen($filename, "rb"); $contents = fread($handle, filesize($filename)); fclose($handle); echo $contents; } else { // if password invalid echo '<p>mot de passe incorrect</p>'; }
this below statement should first line of script. means before html output. solves issue
header("content-type: image/png");
Comments
Post a Comment