...

View Full Version : about <input type=file>



wind0965
01-13-2004, 04:19 PM
the code is:
<input type="file" name="userFile2" size="80" value="C:\" onkeypress="KeyPress()">

But the "C:\" does not show in the text area. Who knows how to show it.

fredmv
01-13-2004, 04:25 PM
You can't set the value attribute of file upload form elements for security reasons. Consider this: someone could set the default value to a sensitive file, for example, a password file, then call the form element's submit method (or hide the element and let the user submit the form), and thus uploading senstivie data to the server. By not being able to set the value attribute of these kind of elements prevents this from happening. Moreover, when you select a file from the dialog, it will print the complete path in the textbox (rendering setting the value attribute useless), you also need to consider not everyone uses Windows as their operating system. I, for example, run Red Hat Linux, and there is no such thing as C:\ here.

glenngv
01-14-2004, 03:35 AM
What fredmv said. The value attribute of file input is read-only.

wind0965
01-14-2004, 09:12 AM
Thank all of you to reply the question. But may I use Cookies to record the path, and to be shown next time the user open the page?

glenngv
01-14-2004, 09:17 AM
Yes of course, as long as you don't display it in a file field. Search for cookie-related threads in this forum or google for cookie scripts if you don't have any.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum