I'm going to store the photo I've uploaded with the name of the textbox specified in the address you want to save, the code that is currently in place for you, the name of the photo you have chosen for the photo name and the photo Stores - use name by inputbux by name imagename
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="userfile" />
<input type="text" value="image" name="imagename" />
<input type="submit" value="submit" />
</form>
<?php
if(isset($_FILES['userfile'])){
$uploadDir = __DIR__ . '/files/';
$filename = $_FILES['userfile']['name'];
$uploadFilePath = $uploadDir . $filename;
$allowFiles = array('image/png','image/jpg');
if(in_array($_FILES['userfile']['type'],$allowFiles)){
if(move_uploaded_file($_FILES['userfile']['tmp_name'],$uploadFilePath)){
echo "Upload Is Success ...";
} else{
echo "File Not Upload , EROR ...";
}}else{
echo "bad Passwand ...";
}
}
echo "<img src='files/" . $filename ."'>";
?>