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.
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.


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

SharePoint Admin?

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

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Google Analytics - viewing a page 10 53
StoredProcedure to JSON query faulty syntax 2 29
Prevent certain words from being typed in a form 6 31
WordPress Page Content Lost 2 21
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

730 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