I was looking at this thread: http://www.photoshopcafe.com/cafe/vi....php?tid=47918
This seems to be what I need. The uploading part works great. But displaying the image is not. I pretty sure I have configured it the way I need it to be but I'm not sure why it's not working. Here is my code for the download page:
And I'm using this to display the image on the page I want.Code:<?php if (! @mysql_connect("mysql","xxxxx","xxxxx")) { $errmsg = "Cannot connect to database"; } @mysql_select_db("inventory"); if(isset($_GET['id'])) { // if id is set then get the file with the id from database include 'config.php'; include 'opendb.php'; $id = $_GET['id']; $query = "SELECT name, type, size, content " . "FROM main WHERE id = '$id'"; $result = mysql_query($query) or die('Error, query failed'); list($name, $type, $size, $content) = mysql_fetch_array($result); header("Content-length: $size"); header("Content-type: $type"); header("Content-Disposition: attachment; filename=$name"); echo $content; include 'closedb.php'; exit; } ?>
<img src="download.php?id=1" border="0" alt="" />
Thanks in advance!



Reply With Quote