Welcome to WebmasterWorld Guest from 220.127.116.11
Forum Moderators: open
<input type="file" size="35" name="imgupload" value="a:\\image.jpg">
But it seems this is only supported by Opera and Opera ask for a confirmation. It doesn't work in IE or FF.
I want to use this for a form in which the user can type in or upload some HTML text and via a PHP script I want to scan the text for IMG tags so the user can easily upload the images after the HTML text has been uploaded.
User agents may use the value of the value attribute as the initial file name.
But in reality it is pretty unworkable: there are two distinct problems, the first being security (hence the confirmation step in Opera, else confidential information could unwittingly be uploaded). The second problem is platform differences: I run Linux, so there is no a:\ path - you can't reliably second-guess a file's location.
You might want to check out Jukka Korpela's (as always) very comprehensive guide:
Thanks for your answer. I'm aware of possible security issues and the Linux 'problem', my idea was to ask the user for a default path to the images and prepend that for each filename.
<input id="fileinput" type="file" size="35" name="imgupload" value="a:\image.jpg">
<a href="#" onlick="fileinput.value='a:\image.jpg'; return false;">a:\image.jpg</a>
In this case the user can click the filename from a list extracted from the HTML test which will be inserted in the input box. But this also doesn't work. Another thing I tried was this:
<input id="fileinput" type="text" size="35" name="imgupload" value="a:\image.jpg">
<a href="#" onlick="fileinput.type='file'; return false;">a:\image.jpg</a>
This also doesn't work, as soon as the link is clicked, a 'Browse' button appears but also the box is emptied.
As for now I have no idea how to solve this apart from displaying a list of filenames and the user has to select and copy and paste them in the input box.