How to insert additional path in If statement using ASP?

Posted on 2011-09-22
Last Modified: 2012-05-12
Dear EE experts,

We would like to ask for tech support on how to insert additional path into this line:
Response.Write "<a href=""" & download1 & """>DOWNLOAD</a>"

Please see the attached code & screenshot for more details.
If a user uploads a photo, it will go to this location: ..\ASIA\photo\DOWNLOAD
Then from the db it started @ DOWNLOAD. I would like to add "../photo/
Because at this moment, user uploads, then try to download the original file, the location would be http://sitename/iphoto/asia/DOWNLOAD.... it should be http://sitename/iphoto/asia/photo/DOWNLOAD...

Kindly advise on how to resolve this case...

Thank you & hope to hear from experts soon...
        				If Session("loggedIn") = true Then
            			Response.Write "<a href=""" & download1 & """>DOWNLOAD</a>"
						End If

Open in new window

Question by:Stiebel Eltron
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
LVL 13

Expert Comment

ID: 36579036

Just use replace or concat function. Of course the name is not concat in ASP.

To user replace function

Response.Write "<a href=""" & Replace(download1, "asia", "asia/photo") & """>DOWNLOAD</a>"


Author Comment

by:Stiebel Eltron
ID: 36579101
@khairil, thanks for the response. But the result is still the same, I tried to browse it in IE & even in Google Chrome, but both gave me an error result...
LVL 13

Expert Comment

ID: 36579239
I think the word "asia" is not in the string,

Try this instead:
Response.Write "<a href=""" & Replace(download1, "download", "photo/download") & """>DOWNLOAD</a>" 

Open in new window

Clear cache from your browser, just in case.
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.


Author Comment

by:Stiebel Eltron
ID: 36579275
Still the same. Haven't seen the word "photo", lol...
LVL 13

Expert Comment

ID: 36579317
can you give me some sampel data and code that you use to generate the "download1" variable?

if possible, can i browse to that page to mention here? so that i can support you better.

Author Comment

by:Stiebel Eltron
ID: 36579393
I'm sorry but we haven't uploaded it yet, but you can see the screenshot for you to see the link on the lower left, I need to have the additional "/photo/" after the asia.
And you can check this thread ID: 27321625, it's the same page, but different subject...
You can see some scripts from there...
LVL 13

Accepted Solution

khairil earned 500 total points
ID: 36580586
i not sure if it is because of case sensitive, but worth trying

Response.Write "<a href=""" & Replace(download1, "DOWNLOAD", "photo/download") & """>DOWNLOAD</a>" 

Open in new window

By default "replace" command  compare using binary, which means case sensitive.

Author Comment

by:Stiebel Eltron
ID: 36585316
Oh! It's really weird! Because yesterday I tried it with the word "download" in lower case, is not working, but now, we just changed it to UPPER CASE, and it's working now! Great!

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question