File fields are sandboxed in all modern browsers, so there are lots of things you can't do, such as setting their value. You can get the value, but you'll only get the name of the file, not the full path to the file.
Here's how you can do this with prototype, though.
<script type="text/javascript" charset="utf-8">
Event.observe(window, "load", function(){
$$("button")[0].observe("click", function(){
$$("input[type=text]")[0].value = $$("input[type=file]")[0].value
})
})
</script>
<input type="file" />
<input type="text" />
<button>Test</button>
Here's the results I get on various browsers on my mac:
- Opera: c:\fake_path[filename here]
- Safari: [filename here]
- Firefox: [filename here]