1

Is it possible to open a file from the parent folder?

lets say I have this file tree

parent
    other
        file.pdf
    website
        index.html

and I wanted to open file.pdf from index using the a tag, how would I do it? Is it possible?

FabianCook
  • 20,269
  • 16
  • 67
  • 115
  • 2
    If you just want a link to download the file, just use "../other/file.pdf" in the A tag. But if you are looking for embed a pdf file, then consult here: http://stackoverflow.com/questions/4853898/display-pdf-within-web-browser – slackmart Sep 29 '12 at 16:38

3 Answers3

4

Use the "special instruction" .. to traverse "up" a directory level:

<a href="../other/file.pdf">file.pdf</a>

It can be repeated multiple times to continue traverse up the folder hierarchy.

Freesnöw
  • 30,619
  • 30
  • 89
  • 138
Alex
  • 34,899
  • 5
  • 77
  • 90
1

Use double dot to go one level up:

<a href="../other/file.pdf">file.pdf</a>
Michal Klouda
  • 14,263
  • 7
  • 53
  • 77
1

Yes, you simply give the full path in the href

<a href="../other/file.pdf">link</a>
FJT
  • 1,923
  • 1
  • 15
  • 14