I'm trying to make a web site (written primarily in HTML, but lots of PHP involved) in which a user would log in, click an "Upload Image" link, upload an image that gets stored in binary inside a MySQL database, then that image is displayed when the user returns to their post-log-in page.
Here's what I have so far for storing the picture in the database.
Code: Select all
addslashes(fread(fopen($_FILES['uploadedfile']['tmp_name'], "r"), filesize($_FILES['uploadedfile']['tmp_name'])));My problem comes when I try to retrieve that image. I have no idea how to do it! Ideally, there would be a javascript slideshow of all the pictures they've uploaded, but that will get asked in a different forum or I'll just learn javascript.
So far, I've been able to download a file (whose name is "download.php") that, once renamed, displays the picture correctly by calling this:
Code: Select all
<a href='download.php?SubmissionId=$data->SubmissionId'>Download</a>Code: Select all
$subid = $_GET['SubmissionId'];
$sql = "SELECT SubmissionTitle,Picture FROM Submission WHERE SubmissionId='$subid'";
$result = mysql_query($sql);
$data = mysql_result($result, 0, "Picture");
header("Content-type:'image/jpg'");
echo $data;Much appreciation!
Raptor354
P.S.: I've tried several examples off the Internet, but to no avail