joebudden Posted January 8, 2007 Share Posted January 8, 2007 hi guys iv written this code to preview image files in the browser[code]<?phprequire("cw1/connect.php");require("cw1/dbselect.php");//echo "<p>".'<a href="viewuploads.php">' . "Back" . "</a></p>";$img = "select artefactId,filename,type,size,content from artefact where artefactId='".$_GET['id']."'";$result = mysql_query($img,$con)or die('Error, query failed');list($artefactId,$filename,$type,$size,$content) = mysql_fetch_array($result);//header("Content-Disposition: attachment; filename=$filename");header("Content-length: $size");header("Content-type: $type");header("Content-name: $filename");echo $content;mysql_close($con);exit;?>[/code]This works, however the filename is view.php which is the name of this page.Its also view.php when i right click and save targetHow can i have it so that the filename is that of the file ??any help please Link to comment https://forums.phpfreaks.com/topic/33315-image-preview-file-name/ Share on other sites More sharing options...
spfoonnewb Posted January 8, 2007 Share Posted January 8, 2007 Try making it print the img src tag, with the URL within it. Link to comment https://forums.phpfreaks.com/topic/33315-image-preview-file-name/#findComment-155974 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.