<form action = "<?php $_SERVER["PHP_SELF"];?>" class="register-form" method="post" name="form1" encype="multipart/form-data">
   <input type="text" placeholder="Username" name="username" maxlength="15" required/>
   <input type="text" placeholder="Email Address" name="email" maxlength="30" required/>
   <input type="password" placeholder="Password" name="password" maxlength="15" required/>
   <input type="password" placeholder="Confirm Password" name="conf_password" maxlength="20" required/>
   <input type="file" name="file" accept="image/*"/>
   <button href="../index.html">create</button>
</form>
These are my HTML tags.
I want to put a default image for this field. The name of the image is default-avatar.jpeg 
I have written this code:
if (isset($_POST["file"])){
    $file = addslashes($_POST["file"]);
    echo "Yes<br>";  
}
elseif(empty($_POST['file'])){
    $file = "default-avatar.jpeg";
    echo "No<br>";  
}
So I suggested when the user chooses another file, the $file variable gets another value, when the user doesn't choose a file, the value of $file stays default-avatar.jpeg
But the value of the file field is never empty. When I tried to echo it has always some value. If the user chooses another file, the value of $file variable is that file, but when he doesn't the value is nothing (I thought it is empty). So the isset($_POST["file"]) is always True. How can I solve this?
 
    