How to change picture name in php page i have file "photo.php" which get id of a picture.
and when i access link location name on title bar show as "photo.php". that means when i click save image as.. a name is "photo.php". i want its name for some field. I've tried
header('Content-Disposition: attachment; filename="'.$name.'"');
but the header sent a picture as download I want to see picture in direct link of it URL.
include("conn.php");
$userimgid = $_GET['id'];
$sql = "SELECT * FROM `file` WHERE `userid` = '$userimgid' ";
$sqlquery = mysql_query($sql)or die(mysql_error());
$num = mysql_num_rows($sqlquery);
if($num!=0){
$type = mysql_result($sqlquery, 0, "mime");
header("Content-type: $type");
$content = mysql_result($sqlquery,0,"data");
echo $content;
}else
echo "Invalid requested.";
Thanks all answers