Hi this is my first post on DaniWeb.... the information has helped me in the past but im seriously stuck.... Help would be very much appreciated..
Im trying to create a form where the user can upload 5 pictures to a mysql database (members) field names are img1, img2, img3, img4, img5.. i have read to design the img fields as varchar100 ??? and for my form to insert the location of the files?? into the database.
********upload form
<html>
<form action='upload.php' method='post' enctype='multipart/form-data'>
<input type='file' name='myfile'>
<input type='file' name='myfile1'><br>
<input type='file' name='myfile2'>
<input type='file' name='myfile2'><p>
<input type='file' name='myfile4'>
<input type='submit' value='upload'>
</form>
</html>
*******
I'v got one file uploading to a "uploaded" folder
***see below
<?php
// properties of uploaded file
$name = ($_FILES["myfile"]["name"]);
//$name = $_FILES["myfile"]["name"];
//$name = $_FILES["myfile2"]["name"];
//$name = $_FILES["myfile3"]["name"];
//$name = $_FILES["myfile4"]["name"];
$type = $_FILES["myfile"] ["type"];
$size = $_FILES["myfile"] ["size"];
$tempd = $_FILES["myfile"] ["tmp_name"];
$error = $_FILES["myfile"] ["error"];
if ($error > 0)
die ("Error uploading file code $error.");
else
{
if ($type == "image/png" || $size > 500000) //file conditions
{
die ("File exceeds maximum file size limit of 0.5mb, saving the file as a JPG or GIF will reduce the overall size of the file");
}
else
move_uploaded_file($tempd,"uploaded/".$name);
echo "Upload Completed";
{
} // end if, after else
} //end if b4 else
?>
but what i dont understand is how i tell the database where the file is ?? and how do i show the file in a mysql query... I have my search working fine as the results are what im expecting them to be...
but these F'n images just will not show >> please please help
***my search
echo "$foundnum results found<br><p>";
while ($runrows = mysql_fetch_assoc($run))
{
//get data
$category = $runrows['catname'];
//$subcategory = $runrows['subcategory'];
$subcats = $runrows['subcats'];
$catdes = $runrows['catdes'];
$keywords = $runrows['keywords'];
$imagelocation = $runrows['imagelocation'];
$img2 = $runrows['img2'];
//$img2 src='image/".$row['imagelocation']."' width='50' height='50'>
//show data as search results
echo "
$category<p><br>
$subcats<br>
$catdes<br><p>
$keywords<p>
$imagelocation //enctype='multipart/form-data'
$img2 <img2 src='image/".$row['imagelocation']."' width='50' height='50'>
<img src='store/".$row['imagelocation']."' width='100' height='100' enctype='multipart/form-data'>
$img2<p>
";
many many thanks in advance if anyone can help me...