JP SIngh wrote:
Hi All
I have users who upload files using my application using ASPUPLOAD
component.
My code uploads the file to a network location and once the upload is
finish I display the hyperlink using the following code
<a href=\myserver\attachments\<%=server.urlencode(rs( "FileName"))%>
Why are you using backslashes in your href ? And why aren't you delimiting
the href value?
target="_blank" ><%=rs("Filename")%>
Sometimes the hyperlinks works but sometimes it doesn't.
Please try to describe your symptoms without using the words "doesn't work".
Should I be using server.urlencode or not.
The problem is my users upload files with all sorts of filename slike
088-888 24(05)-774448.doc which includes spaces, special characters
etc.
So show us what the link looks like when you View Source in the browser.
When I try your example like this:
<a href=images/<%=server.urlencode("088-888 24(05)-774448.doc")%>
target="_blank" ><%="088-888 24(05)-774448.doc"%>
I get source that looks like this:
<a href=images/088%2D888+24%2805%29%2D774448%2Edoc
target="_blank" >088-888 24(05)-774448.doc
which yields this url:
http://webdev/test/images/088%2D888+...2D774448%2Edoc
This link will produce a Page Not Found. If I change the href to
<a href="images/<%="088-888 24(05)-774448.doc"%>"
target="_blank" ><%="088-888 24(05)-774448.doc"%>
I get a link that does open my test document.
So the quick answer is:
use the correct slashes in the url
don't use urlencode
delimit the href value
Now, if the link includes a querystring, the answer will change. The
querystring portion of the url will probably need to be urlencoded. Just the
part after the question mark.
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.