how to validate the file path
800344May 27 2005 — edited May 27 2005Dear all,
Below is a piece of html file.
--------------------------------------------------------------------------------------
<form action="http://www.cs.tut.fi/cgi-bin/run/~jkorpela/echo.cgi"
enctype="multipart/form-data" method="post">
<p>
Please specify a file, or a set of files:<br>
<input type="file" name="datafile" size="40">
</p>
<p>
<input type="submit" value="Send">
</p>
</form>
----------------------------------------------------------------------------------------
The file download mechanism works well.
If I input manually "c:" and then press "submit" button, it will send "c:" to host site. But if I input "c" and then press "submit" button, it will do noting as "c" has no meaning.
This is exactly what I want.
Now I am in the context of JSP/Struts/Javascript, and the submit is done by form.submit() function instead a html submit (<input type="submit" )value="Send">).
Then the problem is that if I input "c" which has no sense, I can not stop "form.submit()" be called and this causes problems.
So mpy question is
how to validate the file path using Javascript?
Regards,
PY