I searched the forums and couldn’t find anything that matched my problem…I’ve created a website using WordPress and it’s all set, works fine. Now I want to create links to documents I’ve written (PDF). I uploaded a test document to my domain using ClassicFTP, to kkieva.com, and I see it there in the correct directory, but when I create the link from my WP page to Test document, I get a 404 File not found error. What am I doing wrong? I have a ton of documents I’d like to upload and link to.
WordPress has a built-in uploader that can handle a PDF. I use this feature to upload newsletters and I have a page that lists my newsletters. Here’s how I do it:
- Log into wp-admin and go to Pages. Edit (not quick-edit) the Page listing my newsletters.
- Move the cursor to where I want the link
- Above the edit window is a row of icons for Upload/Insert; click on the last icon (looks like a sun) for Add Media.
- The upload window opens, so Select Files (or try to upload from URL).
- Once the PDF file is selected and uploaded, the “Title” field becomes the text for the link. In my case, it’d be October, 2010. Something at the bottom of the “Upload Completed” screen makes the link clickable like “Insert URL into post” or something like that.
If you want to futz around with your PDF files before attempting to insert them into your pages, you can use wp-admin and click on Media to Add New and follow steps 4 and 5 above.
sdayman’s suggestion is the best way to do it.
However, for future reference, if you need to upload a file and link to it manually, be sure of 2 things:
You are uploading the file under web root.
You’re using proper relative paths in your link (or just use an absolute path).
On dreamhost, your web root will be something like:
So if you upload to that directory or any subdirectories, your file will be accessible. If you upload outside of that directory, then the file will not be directly accessible (good idea for sensitive files, like database configurations or password files).
The relative paths you use in your links will depend on where you upload to, and where the page containing the link is located.
E.g. if the file is located at /home/bob/domain.com/foo/bar.pdf, then you’d use the following relative paths for each respective web page location:
from: domain.com/index.htm link url: foo/bar.pdf from: domain.com/foo/index.htm link url: bar.pdf from: domain.com/foo/tofu/index.htm link url: ../bar.pdf
But it’s generally easier to just use an absolute path, in which case you would use the following from any web page you wanted to link from:
And if you’re linking across domains or subdomains, then you need to use absolute urls regardless.