Watermark multiple images on upload

This code displays a form that the user can use to add text to multiple images on upload. When the form is submitted the images are uploaded to a tempory location where they are then watermarked and saved into the directory set in the code.

Note: If allowing user uploads the data submitted MUST be checked to stop people uploading code that can compramise the server.

<?php
if ( isset( $_POST['Submit'] ) ){

$up_files $_FILES['filename']; 

$counter 1
    
while(
$counter <= count($up_files))  { 

$img_name $up_files['name'][$counter]; 

$tempory_location $up_files['tmp_name'][$counter]; 

$new_name "Image_name_".$counter.".jpg";  
        
move_uploaded_file$img_name$tempory_location ); 

$cmd $tempory_location -gravity North -font Helvetica-Bold -pointsize 16 ".
" -draw \" fill black text 0,0 'Images copyright of Anthony'\" ".
" -draw \" fill white text 1,1 'Images copyright of Anthony'\" ";
exec("convert $cmd $new_name);

        
$counter++; 
    }   
}

else {
?>
<form method="post" action="<?php echo $PHP_SELF?>" enctype="multipart/form-data"> 
<label>Images to upload<br>
    Image 1 : <input name="filename[1]" type="file"><br>
    Image 2 : <input name="filename[2]" type="file"><br>
    Image 3 : <input name="filename[3]" type="file"><br>
    Image 4 : <input name="filename[4]" type="file"><br>
</label>
<input type="Submit" name="Submit" value="Submit" />
</form>
<?php
}
?>