[thelist] changing link text on-the-fly with JavaScript

Chris Marsh chris at ecleanuk.com
Fri Mar 7 10:00:00 CST 2003


> >from what I understand about what you want, I'm not certain it's
> >possible, for security reasons.
> >
> >file upload boxes are generally a don't-touch area for JavaScript
> >because if it was possible to manipulate them, then a sneaky
> webmaster
> >could grab a copy of your files without you knowing.
>
> I tried a variation on the code Chris sent, and you are
> right, I got an "Access Denied" error when trying to get at
> the value of the file upload field. I guess I will have to go
> with a server-side solution for this. Thanks to both of you
> for your help!

No problem. The following is an example of how you may get the value of
a "file" field.

<html>
	<head>
		<title>
			Test
		</title>
	</head>
	<body>
		<form method='post' action='test.htm' name='fForm'
enctype='multipart/form-data'>
			File: <input type='file' name='fFile' />
		</form>
		<a
href='javascript:alert(document.fForm.fFile.value)'>Click</a>
	</body>
</html>

As I said before, you can read the value, just not write it. I've tested
the code above, with results as anticipated (ie, I get the path to the
file selected).

HTH

Chris Marsh




More information about the thelist mailing list