I'm trying to fill the empty array called $Errors
with some items to make some restrictions on my uploading form.
So I'm trying to put a <div>
tag as an item inside the array and that div tag holds some strings and I want to concatenate these strings with a foreach
loop as shown in the code below but it keeps giving an error and I don't actually know how to concatenate a function like foreach
with strings.
$Errors= array();
$Ext= array('jpg','png','jpeg','bmp','gif');
$FileName= $_FILES ['UploadedFile']['name'];
$FileExt=strtolower(end(explode(".",$FileName)));
if(!in_array($FileExt,$Ext)):
$Errors[]="<div>The file that you're uploading is " . $FileName . " And it is not an image file, only these file types are supported " . foreach($Ext as $AllowedExt):echo $AllowedExt;
endforeach;"</div>";endif;