0

Good morning/evening everyone.

I want to ask if there is any possibility to copy the directory when using:

<div id="AddAttachment" style="display: none;">
        <input type="file" name="FILE" size="40" />
</div>

to another text field on a button click. The above is to browse for a file. Code in HTML.

This is the JavaScript code for the button:

<td>
<button onclick="myfunction()">Create URL</button>
</td>

The function in JavaScript looks like this:

function myfunction() {
var LinkedTypeDiv.value = AddAttachment.value;}

This is the HTML Text field where I want to have the Directory in:

div id="LinkedTypeDiv" style="display: none;">
<input type="text" name="URL" size="40" />
</div>

Its not working on my side and would like to know what I am doing wrong. Thanks

Christoph Bethge
  • 219
  • 1
  • 4
  • 20
  • 2
    possible duplicate of [How to get full path of selected file on change of using javascript, jquery-ajax?](http://stackoverflow.com/questions/15201071/how-to-get-full-path-of-selected-file-on-change-of-input-type-file-using-jav) – J Santosh Sep 09 '15 at 08:24
  • 1
    I believe the browser will display the path as `C://fakepath/filename.format` Images for example: `C://fakepath/myimage.jpg` Browsers do this for security reasons. – NewToJS Sep 09 '15 at 08:24
  • AddAttachment is the id of a `
    `. It is not a JS variable. Also, `
    `s does not have `.value`. You may want to operate on the `FILE` variable (which refers to ``) instead.
    – FelisCatus Sep 09 '15 at 08:25
  • Yes that is correct. I just need to now take that directory as is and duplicate it into a textbox so i can manipulate it my self or later on button click. – Christoph Bethge Sep 09 '15 at 08:29
  • under IE debugger i get an error that says: "FILE" is undefined – Christoph Bethge Sep 09 '15 at 08:56

0 Answers0