erdomester
erdomester

Reputation: 11829

Select file to upload from source

On a webpage the user can select a file to upload then if he submits the form he is directed to the next webpage with a similar, but bigger form. The form elements are filled with the data he entered on the last page

firstpage.html

<form name="MyForm" action="nextpage.php" enctype="multipart/form-data" method="post">
       <input type="text" name="name" size="50">
    <input type="file" name="file" id="file" size="40">
</form>

nextpage.php (partial form, two elements are the same)

<form name="MyForm" action="thirdpage.php" enctype="multipart/form-data" method="post">
       <input type="text" name="name" size="50"  value="<?php echo $name?>">
    <input type="file" name="file" id="file" size="40">
</form>

Is it possible to preselect a file in the file upload element? If he types his name in the name element on firstpage.html, the same element is filled with the name on nextpage.php. But if he selects a file on firstpage.html, is it possible that he doesn't need to select it again on nextpage.php?

Upvotes: 0

Views: 78

Answers (1)

dev-null-dweller
dev-null-dweller

Reputation: 29462

It's not possible, security reasons.

If file was already uploaded, there should be info about it, possibility to delete it and upload something new.

Upvotes: 0

Related Questions