I want to add images goa.jpg, kerala.jpg, delhi.jpg using input type 'file' as multiple. The below code is working perfectly to insert single image.
Now I want to perform multiple image uploading using for loop but I am not getting the actual code without errors. Any one have any experience with this?
$file_name=$_FILES["packageimage"]["name"];
$temp_name=$_FILES["packageimage"]["tmp_name"];
$imgtype=$_FILES["packageimage"]["type"]; if($imgtype!='image/jpeg'&&$imgtype!='image/jpg'&&$imgtype!='image/gif'&&$imgtype!='image/png'&&$imgtype!='image/bmp')
{ $msg = "Please upload only Image file"; }
else{
$ext= GetImageExtension($imgtype);
$imagename=date("d-m-Y")."--".time().$ext;
$target_path = "../upload/products/".$imagename;
move_uploaded_file($temp_name, $target_path);
// query to insert images.
$query=mysql_query("insert into tbl_products set catid='".$catid."', packageimage='".$imagename."', add_date=now()");
if($query)
{
$msg="Product Added Successfull";
}
When I am trying using for loop in above code it stores only first image and display only first image.