-2

I want to set file automatically loaded if exist file in local defined default path. here is the code

<form action="" method="POST" enctype="multipart/form-data">
<input type="file" name="hard_file" >
<input type="submit" name="submit" class="submit">

  • 3
    It is not possible. Only the user can select a file. – epascarello Nov 01 '18 at 20:58
  • your question is not clear. Can you clarify you question in detail? I think you want to know that the file selected by user already exists on your server? – Ajit Kumar Nov 01 '18 at 20:59
  • 1
    Make sure to actually ask a question at least in your title, since this is a Q&A website. Just saying what you want does not make it easy to formulate an answer. – David Meza Nov 01 '18 at 21:11
  • 1
    Possible duplicate of [How to set a value to a file input in HTML?](https://stackoverflow.com/questions/1696877/how-to-set-a-value-to-a-file-input-in-html) –  Nov 01 '18 at 21:37

1 Answers1

0

all you have to do is follow this post

How to set a value to a file input in HTML?

In there is a reazon for what that is not permitted:

You cannot due to security reasons.

Imagine:

<form name="foo" method="post" enctype="multipart/form-data">
    <input type="file" value="c:/passwords.txt">
</form>
<script>document.foo.submit();</script>

You don't want the websites you visit to be able to do this, do you? =)