Just Try With The Following :
PHP Part :
<?php
$sz_err="";
$tp_err="";
if(isset($_POST['save'])){
$rand=rand().time();
$photo_name=$_FILES['photo']['name'];
$photo_tmp_name=$_FILES['photo']['tmp_name'];
$photo_name=explode(".",$photo_name);
list($width,$height) = getimagesize($photo_tmp_name);
if($photo_name[1]=="jpeg"||$photo_name[1]=="jpg"||$photo_name[1]=="gif")
{
if($width<=365)
{
$photo_name=$photo_name[0].$rand.".".$photo_name[1];
move_uploaded_file($photo_tmp_name,"Images/{$photo_name}");
}
else
{
$sz_err="Not correct Perfect Size";
}
}
else
{
$tp_err="Not correct Type";
}
}
?>
I think this may help you to resolve your problem.