ffunit. You do not want to store any media, ever, in a database. Your db will quickly grow to an enormous size and queries will start taking longer amounts of time. It's also not considered a best practice. Here's a portion of a script I use for such a matter. I've found it's easier to learn by seeing then by reading.
if($_FILES['file']['size'] > 0){
$target_path = "../propimages/properties/";
$tmp_name = $_FILES['file']['tmp_name'];
$name = str_replace(" ", "_", $_FILES['file']['name']);
if(!move_uploaded_file($tmp_name, "$target_path$name")){
if(!is_writable($target_path)){
echo "path not writable<br />";
}
echo "Could not upload the file<br />";
echo "$target_path$name<br />";
echo $target_path."<br />";
exit();
}else{
$propertyPhoto = "$target_path$name";
}
$query = "INSERT INTO `pictures` SET
propertyID = '".$id."',
path = '".$propertyPhoto."'";
$result = mysql_query($query);
}
}