Hook the event changeinto the file field.
<form method="post" enctype="multipart/form-data">
<input type="file" onchange="this.form.filename.value = this.value">
<input type="text" name="filename">
</form>
Jsfiddle demo . Please note that IE6 / 7 incorrectly sets the full path, while other browsers correctly give only the file name.
source
share