• Resolved blpollock

    (@blpollock)


    I am confused by the WP folder structure on my server. I would like to offer a .pdf document for download by site visitors. I started off by trying to upload it using the Media Library interface, but for some reason, once the .pdf hit the Library, WP automatically turned it into a post – which I don’t want. I want to have a clickable link to take you to the file.

    So then I tried to simply FTP the file directly into (what I thought was)the root directory for my domain (/”public_html”). But when I type in “domain.com/file_name.pdf”, I get a 404. So apparently, the WP file structure is not like a normal html website.

    Can anyone provide guidance on the best way to get this .pdf into my site? Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Turned into a post? Do you mean that the PDF file is opening in browsers rather than giving a download option. There are two ways you can force the user to download the pdf file:

    1) change to .htaccess

    <FilesMatch "\.(?i:pdf)$">
      ForceType application/octet-stream
      Header set Content-Disposition attachment
    </FilesMatch>

    before making changes to .htaccess, please take backup for your orginal .htaccess file.

    2) HTML5 Way

    <a href="http://link/wp-content/uploads/filename.pdf" download="FileName">Download PDF</a>

    Source: http://updates.html5rocks.com/2011/08/Downloading-resources-in-HTML5-a-download

    Thread Starter blpollock

    (@blpollock)

    Thanks for your response, but that’s not what I mean. Rather than try to describe what happened, maybe I should describe what I want to do. I simply want to load a .pdf document to my site and know what its URL will be so I can link to it and visitors can view it. I know this sounds ridiculously simple, but when I FTP’d the file to my server (into what I assumed was the home directory) and then typed what I assumed to be the URL into my browser (e.g. domain.com/file_name.pdf) the file is not found.

    I’m assuming it’s because the WP file/folder structure works differently?

    Did you upload the PDF file to public_html or the folder where all other wordpress php file were located?

    Thread Starter blpollock

    (@blpollock)

    To the public_html folder. What would be the correct name for the correct folder? I suspected this was my problem, but I wasn’t sure which folder to aim for. Thanks your help.

    you would have to upload your PDF file to folder where all your wordpress files and folders are located.

    Thread Starter blpollock

    (@blpollock)

    I’m sorry to be so thick about this, but it’s not clear to me which folder that would be. Within the public_html folder, I have the following folders:

    /cgi-bin
    /wp-admin
    /wp-content
    /wp-includes

    I have tried putting the .pdf into /wp-content (which seems closest to what you have described) but this still returns a 404 when I try to go to domain.com/file_name.pdf.

    Thread Starter blpollock

    (@blpollock)

    Follow-up: I have tried again to use the Media Library uploader to place the .pdf into my server and I appear to have resolved things. Thanks for your assistance.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Which folder for a downloadable .pdf file?’ is closed to new replies.