Hi,

I have 6 file input fields for inserting images (none of them is required, can be all and none):

Code:
<input type='file' class='file' name='ad[slider][1]' />
<input type='file' class='file' name='ad[right][1]' />
<input type='file' class='file' name='ad[bottom][1]' />
<input type='file' class='file' name='ad[slider][2]' />
<input type='file' class='file' name='ad[right][2]' />
<input type='file' class='file' name='ad[bottom][2]' />
and I have php code for uploading images and inserting position on web site and position on page for every image (slider/right/bottom is position on page and 1/2 is home page or rest of site) but I dont know how to get positions ($page and $part) from those inputs above and insert them in database.
There are probably some errors in rename file or something, but now I just want to know how to define properly $page and $part for images.

PHP Code:
foreach($_FILES['ad'] AS $key=>$file) {

$fileName $file["name"];
$fileTmpLoc $file["tmp_name"];
$fileType $file["type"];
$fileSize $file["size"];
$fileErrorMsg $file["error"];
$fileName preg_replace('#[^a-z.0-9]#i'''$fileName); 
$kaboom explode("."$fileName);
$fileExt end($kaboom);
$fileName time().rand()."-$sef.".$fileExt;

if (!
$fileTmpLoc) {
    echo 
"ERROR: Please browse for a file before clicking the upload button.";
    exit();
} else if(
$fileSize 5242880) {
    echo 
"ERROR: Your file was larger than 5 Megabytes in size.";
    
unlink($fileTmpLoc);
    exit();
} else if (!
preg_match("/.(gif|jpg|png)$/i"$fileName) ) {  
     echo 
"ERROR: Your image was not .gif, .jpg, or .png.";
     
unlink($fileTmpLoc);
     exit();
} else if (
$fileErrorMsg == 1) {
    echo 
"ERROR: An error occured while processing the file. Try again.";
    exit();
}

$moveResult move_uploaded_file($fileTmpLoc"image/ads/$fileName");
if (
$moveResult != true) {
    echo 
"ERROR: File not uploaded. Try again.";
    exit();
}

$query="insert into ads(page, part, img, user) values ('$page', '$part', '$fileName', '$user')";

$rs=mysql_query($query) or die(mysql_error());

Thank you