I am writing a script to display a random image.
Here is the code I am using
<?php
// Get img data
$fp = fopen($imgName,"r");
$size=filesize($imgName);
header("Content-Type: image/jpeg");
header("Content-disposition: attachment;
filename=$imgName");
header("Content-Length: $size");
header("Content-Transfer-Encoding:
binary\n");
?>
The image displays properly, but if you try to save it it assumes the name of the script. Not what is specified in the Content-disposition header. If I put static text ( i.e. "Content type: attachment; filename=myimg.jpg" ) it works. But the variable name is not working. ???
Thanks
Adam