I've used Dreamweaver before and linked mp3's etc. Now, I want to link text to a PDF and test it and I get an error! Please help!

Dani AI

Generated

As noted, links are just URLs, and as discovered the hard way, a PDF filename with spaces will often break a link. Raw spaces are not valid in URL paths and can be interpreted inconsistently by editors, browsers, or the server.

The simplest, most robust fix is to use web-friendly filenames (ASCII, lowercase, hyphens or underscores). If renaming is not an option, spaces must be percent-encoded as %20 in the URL; see the MDN note on percent-encoding for details: Percent-encoding (URL encoding).

Practical checklist:

  • Rename files to use only letters, numbers, hyphens or underscores (for example: my-file.pdf or my_file.pdf).
  • If you must keep spaces, replace them with %20 in the link target.
  • Verify the path is correct relative to the HTML file and remember many Linux servers are case sensitive.
  • Make sure the PDF was uploaded to the site root (use Dreamweaver's Files panel) and test the direct URL in a browser.
  • If a link still fails, check server response (404 vs. 403) and that the file is readable by the web server; the Content-Type should be application/pdf.

Renaming is usually quickest and prevents similar problems with other special characters.

Recommended Answers

All 2 Replies

what code you are using for linking ?

<a href="URL of PDF File">PDF Link </a>

Thanks! I got it! The file that I was trying to link to had spaces in the name. Duh!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.