ATLien
asked on
check to see if a form feild is empty.
Ok I am creatying a script and in this script I allow for users to upload multiple pictures. Here is the script I have so far.
# DEALING WITH PIC_UPLOADS Part 1
if($HTTP_POST_FILES['pictu re2']){
$picture2 = $HTTP_POST_FILES['picture2 ']['tmp_na me'];
$pic5 = getimagesize($picture2) or die("gis_failed");
$ext = pic_allowed( $pic5[2] ) or list($submit_err_msg, $act) = array("pic_format_not_allo wed", "signup");
$ext = "." . strtolower($ext);
}else{
$picture2 = $HTTP_POST_VARS['picture2' ];
$pic5 = getimagesize($picture2);
}
if($pic5){
$pic2_width=$pic5[0]; $pic2_height=$pic5[1];
}else{
$submit_err_msg="pic_not_f ound"; $act="signup";
}
# DEALING WITH PIC_UPLOADS Part 2
if($HTTP_POST_FILES['pictu re2']){
#GENERATING A UNIQUE FILENAME BASED ON THE TIME AND REMOTE IP - AND IF THAT ISN'T UNIQUE I DON'T KNOW WHAT IS
$filename = "uploads/" . preg_replace("#\W#", "", $HTTP_POST_VARS['user']) ."-". md5(microtime() . $HTTP_SERVER_VARS['REMOTE_ ADDR']) . $ext;
copy($HTTP_POST_FILES['pic ture2']['t mp_name'], $root_path . $filename);
@chmod($root_path . $filename, 0755);
$picture2 = $filename; #For the database
}
I wanted make it where it will only get the image size if there is infact a image selected in the picture2 feild of the forum. See what I am getting is a error that says it can't get image size if I have not selected to upload a second picture. How can I make it to where the script above will only process if there is in fact a picture selected to upload. If there is no picture selected to upload then it will nt attempt to process this portion of the script.
# DEALING WITH PIC_UPLOADS Part 1
if($HTTP_POST_FILES['pictu
$picture2 = $HTTP_POST_FILES['picture2
$pic5 = getimagesize($picture2) or die("gis_failed");
$ext = pic_allowed( $pic5[2] ) or list($submit_err_msg, $act) = array("pic_format_not_allo
$ext = "." . strtolower($ext);
}else{
$picture2 = $HTTP_POST_VARS['picture2'
$pic5 = getimagesize($picture2);
}
if($pic5){
$pic2_width=$pic5[0]; $pic2_height=$pic5[1];
}else{
$submit_err_msg="pic_not_f
}
# DEALING WITH PIC_UPLOADS Part 2
if($HTTP_POST_FILES['pictu
#GENERATING A UNIQUE FILENAME BASED ON THE TIME AND REMOTE IP - AND IF THAT ISN'T UNIQUE I DON'T KNOW WHAT IS
$filename = "uploads/" . preg_replace("#\W#", "", $HTTP_POST_VARS['user']) ."-". md5(microtime() . $HTTP_SERVER_VARS['REMOTE_
copy($HTTP_POST_FILES['pic
@chmod($root_path . $filename, 0755);
$picture2 = $filename; #For the database
}
I wanted make it where it will only get the image size if there is infact a image selected in the picture2 feild of the forum. See what I am getting is a error that says it can't get image size if I have not selected to upload a second picture. How can I make it to where the script above will only process if there is in fact a picture selected to upload. If there is no picture selected to upload then it will nt attempt to process this portion of the script.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I will leave a recommendation in the Cleanup topic area that this question is:
> Accept comment from aishcash
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
ThG
EE Cleanup Volunteer