1

Note:

The answers & comments below reflect the state of legacy browsers in 2009. Now you can actually set the value of the file input element dynamically/programatically using JavaScript in 2017.

See the answer in this question for details as well as a demo:
How to set file input value programatically (i.e.: when drag-dropping files)?

Hello everyone is there any way to set input type file's value from my url ? When I add my image file destination to value it can't be displayed

Here is my view:

<div class="editor-label">
    <input type="file" name="file" id="file" value="../../banner_image/test.jpg" required="required" />


        </div>
Samuel Liew
  • 76,741
  • 107
  • 159
  • 260
learnmore
  • 435
  • 1
  • 8
  • 26
  • check this in firebug that image is loading or not – NullPoiиteя Oct 21 '12 at 16:28
  • The value of the file input represents the path to the file on the **client's** system. `../../banner_image/test.jpg` makes no sense in this context. – Asad Saeeduddin Oct 21 '12 at 16:29
  • Wild blind guess - you're mixing code tags and file types. Use an absolute URL instead of relative. Without more context, we can't tell anything or help! – nickhar Oct 21 '12 at 16:32

1 Answers1

0

Generally - NO WAY! This filed is protected and in some cases you can get the filename (not the whole path) but ... in some browsers. Not possile to set it via html value attribute or using JS.

Reflective
  • 3,854
  • 1
  • 13
  • 25