hey folks,
i m in lot of problem. i have a project i m working on. i have a form made which upload file into a folder calls uploads. now i wanna get them to display but before that i wanna send them to database of images but i am confused how.
Printable View
hey folks,
i m in lot of problem. i have a project i m working on. i have a form made which upload file into a folder calls uploads. now i wanna get them to display but before that i wanna send them to database of images but i am confused how.
just curiosity. suppose if i m making a form which submit text field n upload an image in a database. how does the process follow. is it the image upload inupload dir and create a id for itself in blob field in mysql and like this or wht is the system/process involved in this?
you should not store images in database, just the path to the images.
how do i store its path? with a relational database like a form with a option for pic upload.
Something like this:
PHP Code:<?php
if (isset($_POST['submit']))
{
$img = "images/" . $_FILES['myFile']['name'];
if (move_uploaded_file($_FILES['myFile']['tmp_name'], $img))
{
mysql_query("INSERT INTO images SET path='$img'") or die(mysql_error());
}
}
?>
<form action="" method="post" enctype="multipart/form-data">
<input name="myFile" type="file" /><br />
<input type="submit" name="submit" />
</form>
so this is all to sending a image into images folder n sending a path to mysql on where it is stored? or there is something else?
what i m looking for is when i upload an image in php directory images using a form filled from my cms. the image goes into images folder and mysql give that image an id to identify which is at image 1 or 2 and so on
Yes
well i will try and keep u posted. thnx for now