Html: link to a local file

Solved
dubidon Posted messages 8 Status Member -  
 corentin -
Hello,

I am looking to create a link to a PDF file that is located on a local disk.
For that, I am using the following code in my HTML page:
<a href="file:///D:/monFichier.pdf">file</a>

When the HTML file is also located locally (on C drive), the link works fine
(Acrobat Reader successfully opens "monFichier.pdf").

However, when I upload the same HTML file to a website (on Free),
the link no longer works: nothing happens when I click on the link.

Thank you in advance for your help.
Configuration: Windows XP Firefox 2.0.0.6

12 answers

  1. Yoan Posted messages 11905 Status Moderator 2 356
     
    Hello,
    to make this document accessible, you need to upload it to the server as well, and then use the relative URL of your file. For example, you will have:
    <a href="monFichier.pdf">file</a>
    provided that monFichier.pdf is located in the same directory as the page containing this code.
    If the directory is different, you adjust it:
    <a href="/documents/PDF/monFichier.pdf">file</a>
    <a href="../documents/monFichier.pdf">file</a> (../ refers to the parent directory)
    --
    The urgent is done, the impossible is in progress,
    For miracles, please allow some time ...
    13
    1. dubidon Posted messages 8 Status Member 2
       
      Thank you Yoan for your response.

      Actually, what you're suggesting doesn't really help me
      because it's precisely what I'm trying to avoid (my initial question
      was probably not clear enough).

      To be more specific, I want to access a whole bunch of pdf files
      that are on a small external drive of my PC and that I don't want
      to upload to the website due to space issues and the time spent uploading these files.

      I believe it should be possible to do this.
      That's what seems to be indicated on this excellent site:
      htmlhypertxt
      3
    2. marco
       
      thank you
      0
    3. corentin
       
      Thank you for all this help.
      0