I am unable to upload files using html control.
lets suppose i have two image files
image1.jpg and image2.jpg
image1 gets uploaded
image2 doesn’t
Everything is fine with image1 ,the same code gets called for image2 but image2 is not uploaded.
It is not giving any error.
There is no upload restriction like file size and/or extension.
I have also changed the php.ini with changes in maxpostsize,uploadsize and memory limit.
Please help out, I have been searching this thing for three days but never got the reply.
if(isset($_POST['submitBtn']))
{
$title=$_POST['titleTxt'];
mysql_query("INSERT into tblsliderphotos (title) values('$title')") or
die(mysql_error());
if($_FILES['file']['name']!="")
{
//echo $_FILES['file']['name'];
$tblData=mysql_query("Select MAX(photoid) as id from tblsliderphotos");
$row=mysql_fetch_array($tblData);
$id=$row['id'];
$path="photos/SliderPhotos/". $id.".".$image_ext;
echo $path;
move_uploaded_file($_FILES["file"]["tmp_name"],"../../".$path);
mysql_query("Update tblsliderphotos SET path='".$path."' where
photoid=".$id);
}
}
I think the problem is not with php env. but with your upload file handling.
let’s suppose your html code something like below
Now, you have to notice there is two input of type “file”, first one have name value “file”, and the second have name value “file2”.
When you want to deal with both, you have to handle every file alone. as below:
Now, when you want to upload both of files, you have to do this for each. as below:
This will upload both of files to your $path
However you can do same thing with looping over $_FILES variable, as below:
I hope this help