I have a multipar from to send images but this images are optional so if the user dont send an image my code will be false because the $_FILE variables will be empty.
What I want is this: If their is an image execute the code below if not do nothing
if(isset($_FILES['file_array'])){
$imageName = $_FILE['file_array']['name'] ;
$imageTempName = $_FILE['file_array']['tmp_name'] ;
$imageBlob = file_get_contents($_FILE['file_array']['tmp_name']) ;
$imageSize = $_FILE['file_array']['size'] ;
}
Thank you very much!!
You can use something like mime_content_type()
to check if a file is an image.
Perhaps something like
if (stripos(mime_content_type($_FILES['file_array']['tmp_name']), "image") !== FALSE) {
// Image sent.
}