Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to validate the file path

800344May 27 2005 — edited May 27 2005
Dear 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 24 2005
Added on May 27 2005
1 comment
179 views