Your database should be designed for what it needs to do, not just what it needs to hold.
So CAN you structure your database like that, sure,
SHOULD you? it depends on the relationship between the images and the rest of yoru content.
if you are uploading multiple images, each file field should have a unique name, each name will be available (if the upload is successful) as a $FILES array
you can cicle through each file by
$UploadDir="mydirectory/";
while($file=each($_FILES))
{
$rand_name=md5(substr(md5(rand(1000,9999)), 0, 6));
// some sort of random name
/// get the extension
$ext = substr($file["name"], strrpos($file["name"], "."), strlen($file["name"]));
//// check for override
while(is_file($UploadDir.$rand_name.$ext))
{
$rand_name=md5(substr(md5(rand(1000,9999)), 0, 6));
}
///you need copy the files from the temporary folder to it's permanent directory
if (move_uploaded_file($file["tmp_name"], $UploadDir.$rand_name.$ext))
{
$SQL = "INSERT INTO `mytables` (`Name`, `Image_name`,`Image_size`)
VALUES (NULL, '".$UploadDir.$rand_name.$ext."','".$file["size"]."')";
if (!mysql_query($SQL)) die(mysql_error());
}
else echo "Error uploading file ".$file["name"];
}
this is an off the top of my head thing, it can be greatly tightened and secured and streamlined, but it should give you an idea of how i'm going through each on of the $_FILES array to upload the file and enter it into my database