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)?
I want to set form fields using jquery, I make like this
$("#title").val('${media.title}');
for
<label>Media title</label>
<input type="text" name="title" id="title"/>
and it works properly,but when I make like this
$("#fileName").val("${media.fileName}");
or
$("#fileName").attr({value:'${media.fileName}'});
for
<label>upload file</label>
<input type="file" name="file" id="fileName"/>
it doesn't wok, can somebody help ?