Hi, sorry for a noob question, but I'm having problem with this small code that doesn't work.
I have secret image path written in php file which must be given to HTML parameter. After this I want to make PHP send file of mime type "audio/mpeg3".
The thing is to hide actual file paths.
Every code is as simple as it can get hopefully. I run these files locally with Firefox and they are located in the same folder: phptest.html, phptest.php, car.jpg.
I have HTML file:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<p>Image given by .php file:</p>
<img src="phptest.php?id=1">
</body>
</html>
It's really simple, just look at body tag. The whole phptest.php file:
<?php
$path='';
if ($_GET["id"] === "1"){ //More "if" statements planned
$path = 'car.jpg';
}
header('Content-Type: image/jpeg'); //Don't need too much headers?
readfile($path);
exit();
?>
PHP is supposed to read file with "id" paramenter. But Somehow this doesn't work.