mateamargo Posted June 7, 2006 Share Posted June 7, 2006 I have an image in a blob column.In a page called getimage.php I do an echo of the content, and the image displays correctly in the main.phpso, I use [b]<img src="getimage.php?id=1" />[/b]The problem is when I save the picture to the disk the name is getimage.jpg. I have the original name saved into the database, is there any way to display the original name when saving?Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/11409-image-in-a-blob-column/ Share on other sites More sharing options...
redarrow Posted June 7, 2006 Share Posted June 7, 2006 You need to put the name of the input form of uploading file as userfile_name.In the database also put userfile_name.Then somthink like this think as i am a learner good luck.upload_result.php[code]<?database connectionif(!$userfile=="none") {echo" sorry no file specified";}$type="$_FILES['userfile']['type']=='audio/mpeg' ";$size="$_FILES['userfile']['size']=='20000' ";if($size=='20000') {if($type) {move_uploaded_file($userfile, "pic folder name/",$userfile_name) {$query="insert into music values('userfile_name')";$result=mysql_query($query);echo"file uploaded";}else{echo "sorry no file uploaded";}else{echo"sorry wrong file type";}else{echo"Sorry wrong file size";}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/11409-image-in-a-blob-column/#findComment-42808 Share on other sites More sharing options...
mateamargo Posted June 8, 2006 Author Share Posted June 8, 2006 I think you misunderstood my problem.I have already the file in my database into a longblob column, and also I have the original file name and the file type.[b]getimage.php[/b] page[code]<?phprequire_once("filedisplay.class.php");$id = $_GET["id"];$ob_disp = new filedisplay();$row = mysqli_fetch_array($ob_disp->get_by_id($id));header("Content-Type:".$row["file_type"]);echo $row["file_blob"];¿>[/code][b]MAIN.php[/b] page[code]<img src="getimage.php?id=1" />[/code]The image displays correctly, the ID 1 is just for the example. I want that when I save the image into my disk (right click on it and "Save image as...") appears the real image name (that I have stored in "file_name" field into my database.It is clear now?Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/11409-image-in-a-blob-column/#findComment-43036 Share on other sites More sharing options...
poirot Posted June 8, 2006 Share Posted June 8, 2006 As this behavior is controlled by the browser, I don't think it's possible to change it with PHP or maybe anything.Maybe you COULD use javascript, but for "exotic" features like this, guaranteeing cross-browser compatibility is a problem. Quote Link to comment https://forums.phpfreaks.com/topic/11409-image-in-a-blob-column/#findComment-43039 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.