hello guys how are you i wrote this code but i have an proplem i can not verify if there is no file uploaded when anyone hit submit and i can not specific the allowed extinsion for example "jpg" how can i do this in "foreach", i can do this when i upload just one image but this code for multi upload and if have you noticed i have used array in the form.


mysql_connect('localhost','root','root')or die (mysql_error());



if ($_POST['submit'] ){


foreach($name as $key=>$value){

$imgpath = rand().'.jpeg'; 

$insert=mysql_query("insert into  imagelocation values('','images/$imgpath')")or die (mysql_error());
$select=mysql_query("select * from  imagelocation where id='$id' ");

while ($row=mysql_fetch_object($select)){
echo "<center><img src='$row->images'/></center><br/>";



<form action='' method='post' enctype='multipart/form-data'>
<input type='file' name='file[]' multiple />
<input type='submit' name='submit'/>

if ($_FILES)
$temp_file = $_FILES['ufile']['tmp_name'];
 $upload_dir = "uploads";
$name = $_FILES['ufile']['name'];
case 'image/jpeg': $ext = 'jpg'; break;
case 'image/gif': $ext = 'gif'; break;
case 'image/png': $ext = 'png'; break;
case 'image/tiff': $ext = 'tif'; break;
default: $ext = ''; break;
if ($ext)
$n = "$pic_name.$ext";
move_uploaded_file($temp_file, $upload_dir."/". $n);
echo "Uploaded image <img src='uploads/$pic_name.$ext'/> as '$n':<br />";

else echo "'$name' is not an accepted image file";
else echo "No image has been uploaded";


I would recommed you try the above, as it tells wether a file is uploaded or not, or you could single out that fucntion and integrate it in your code. 

the proplem is i am newbie in php and i can not understand every things you write how it will be with my code and the code you have whrote is for upload one image not multi upload

please help me

Would it not make more sense to get a single upload functioning first, then you can modify the coding for multi upload

tahnk you guys propblem has been solved