how to add variable file name to <a herf>

Hi
what i want to do is to add link to afile in my jsp page, the path of my files are constant for example
"c:\uplods" , but the file name may change , how i can concatenat the path with the file name so the user can click on the filename and the file opend
<a hert="c:\uploads"> filename </a>
master_programmerAsked:
Who is Participating?
 
contactkarthiConnect With a Mentor Commented:
<a href="c:\\uploads\\"<%=filename%>> <%=filename%></a>
0
 
R7AFCommented:
Well that won't work. First you link to a local file. If the user clicks on it, the link is local for the visitor, so it would link to a file on the user-computer. Probably there is no such file. Second, this is not allowed in most browsers. You cannot link to a local file (using C:) unless the page is opened locally (with file:/// instead of http://).

What webserver do you use? Tomcat? If so you can simply create a mapping to that directory, and then use a relative path.
0
 
master_programmerAuthor Commented:
Yes i am using tomcat and my web site is local, what do you mean by:
 create a mapping to that directory, and then use a relative path.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.