473,320 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Dynamic File Path

12
Hi,

I want to display a PDF/HTML file (this will be a fixed name) on click of a link (in <a href...>Click Here</a>) . However, the file will be stored in different directories e.g. S;\Common\01May2007, S:\Common\02May2007 etc.

The user should be able to provide (There will be a textbox for User Input) the last part of the filepath i.e. 01May2007 and then the file stored in that path (S:\Common\01May2007) should be displayed.

How do I achieve this?

Many Thanks.
May 23 '07 #1
7 1905
acoder
16,027 Expert Mod 8TB
Just take the user input and add the directory path to it:
Expand|Select|Wrap|Line Numbers
  1. var newpath = dirpath + userfile;
May 23 '07 #2
shimant
12
Just take the user input and add the directory path to it:
Expand|Select|Wrap|Line Numbers
  1. var newpath = dirpath + userfile;

acoder, Thanks for your reply. I have written the following script:
-------------------------------------------------------------------------------
<html>
<head>
</head>
<body>

<SCRIPT LANGUAGE="JavaScript">

var filepath = 'S:\Common\ALM Reports\MaturityGapAnalysis.htm';

</SCRIPT>

<a href = "filepath">Click Here</a>

</body>
</html>
----------------------------------------------------------------------------------------------------
But, this does not work. I dont get any error. But the file (MaturityGapAnalysis.htm) is not displayed. When I use the explicit path (<a href = "S:\Common\ALM Reports\MaturityGapAnalysis.htm">Click Here</a>)
, it works.

So, my question is still - Can we have a variable in HREF instead of the full path?

Many Thanks.
May 23 '07 #3
acoder
16,027 Expert Mod 8TB
Oh, I see what you're doing. Try this:
Expand|Select|Wrap|Line Numbers
  1. document.write("<a href='"+filepath+"'>Click here</a>");
May 23 '07 #4
shimant
12
acoder, again thanks for your reply.

As you suggested, I tried the following:

<html>
<head>

</head>

<SCRIPT LANGUAGE="JavaScript">

var filepath = 'S:\Common\ALM Reports\Maturity_Gap_Analysis_v1.1.htm';

document.write("<a href='"+filepath+"'>Click here</a>");

</SCRIPT>

<body>

</body>
</html>

Does not work !! :-(
May 23 '07 #5
acoder
16,027 Expert Mod 8TB
Since the string contains the backslash escape character, you will have to escape it, i.e. replace all occurrences of \ with \\.
May 23 '07 #6
shimant
12
acoder, Brilliant !! That works. Many Thanks.
May 23 '07 #7
acoder
16,027 Expert Mod 8TB
You're welcome any time.
May 23 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: JavaScriptRocks | last post by:
I've been trying to imitate / reverse engineer the add attachment feature in gmail composer. I managed to do it to say about 80% but its giving me trouble in IE on WinXP-Sp2. I am using PHP to do...
3
by: Stephen Gennard | last post by:
Hello, I having a problem dynamically invoking a static method that takes a reference to a SByte*. If I do it directly it works just fine. Anyone any ideas why? I have include a example...
2
by: Justin | last post by:
Hi, I m doing a windows program using VB.net for my school assignment. I would like to ask is there a way for me to set a path (eg: //SamPC/data) as something dynamic such as dynamic...
1
by: Director - Minvent | last post by:
I am having a problem! I am using the Task Pane control which MS gave out in their VBPowerPack. If I add an image to the task frame I have to use a physical path e.g. c:\connected.bmp as...
7
by: Ben R. | last post by:
Hi, I'm working on an ASP.NET 2.0 site and my hosting provider has the root in a different place than I have it locally which is not a problem for most things, except for the access oledb...
7
by: Mike Livenspargar | last post by:
We have an application converted from v1.1 Framework to v2.0. The executable references a class library which in turn has a web reference. The web reference 'URL Behavior' is set to dynamic. We...
6
by: Bill Spotz | last post by:
Hi, Is there a way to tell an executing python script where to look for dynamically-loaded libraries? My situation is that that I am developing python wrappers for a large software project. ...
0
by: OverTheTop | last post by:
All the usual Newbie stuff applies... I have a Windows2000 Server with ActivePerl and a module (DBD-Interbase) that worked fine. Trying to duplicate the environment on Windows2003 Server for...
1
by: Jez | last post by:
Can anyone help me with this ?? ASP on Windows 2003 filename = "file.asp?id=" & ID Server.Execute("filename") This doesn't work... Any ideas ? Thanks
9
by: Christopher Koeber | last post by:
Hello, I am attempting to perform a PHP installation on an Apache 2.2.6 web server instance that is loaded on a Windows 2003 server operating system (R2 SP2). I have a third party application...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.