Solved

How to insert additional path in If statement using ASP?

Posted on 2011-09-22
8
325 Views
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

download-location.jpg
0
Comment
Question by:Stiebel Eltron
  • 4
  • 4
8 Comments
 
LVL 13

Expert Comment

by:khairil
ID: 36579036
Hi,

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>"



0
 

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...
:-(
0
 
LVL 13

Expert Comment

by:khairil
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.
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

Author Comment

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

Expert Comment

by:khairil
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.
0
 

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...
download-location2.jpg
0
 
LVL 13

Accepted Solution

by:
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.
0
 

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!
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
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.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

773 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