Is it possible to use <input type = "file"> only to publish the file name without actually downloading the file?
Well, I really didn't know how else to summarize the headline. I need to create a form in which the user can specify an existing file, but I do not need to upload it (it is already available on the shared server) - I just need to capture the file name and save it in the database so that it is associated with other data.
I thought about the input tag, as it provides a convenient, already processed interface for the user file system, but I don't know if it can be used without acutal upload (leaving enctype="multipart/form-data"it doesn't seem to work). Can I set it up to work, or is there a way to do this other than writing a custom mini file browser?
EDIT: I need the full path name of the file, asking users to enter it is out of the question ...
You can post <input type="file">outside your HTML form and then use the event onChangeto fill <input type="hidden">in the form that is submitted:
<input type="file"
onchange="document.getElementById('hidden_file').value = this.value;" />
<form method="POST">
<input type="hidden" id="hidden_file" value="" />
<input type="submit" />
</form>