JavaScript
x
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div class="header">
<H2>Login</H2>
</div>
<form method="post" action="https://..." enctype="multipart/form-data">
<?php include 'errors.php'; ?>
<div class="input-group">
<input type="text" name="username" placeholder="Username..." value="<?php echo $username; ?>">
</div>
<div class="input-group">
<input type="password" name="password_1" placeholder="Password...">
</div>
</div>
<div class="input-group">
<input type="file" name="image" placeholder="Image..." value="<?php echo $image; ?>"> // The File doesn't get echo in after submit and an error
</div>
<div class="input-group">
<button type="submit" name="login" class="btn">Login</button>
</div>
</form>
</body>
</html>
This Form is to register Users with an Image. After submit I check if there Name is all ready taken and look for other errors if there is an error I want that everything is still in the Form except the password. It is working with the Username but not with a file (Image). So how can I do that?
Advertisement
Answer
It is by default impossible to set a default value for a file picker due to security reasons
Learn more about it here