• Hello,
    every sunday I upload direct on FTP weekly.pdf file in /root/docs/. Document has different content.
    If I upload file (overwrite), it changes in website in some hours or if I repeat CTRL+F5 in browser.

    Is there any way to change PDF file immediately after upload?

    Thank you.

    • This topic was modified 2 years, 11 months ago by WPUser.
    • This topic was modified 2 years, 11 months ago by Jan Dembowski.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Different people will get different results based on their browser settings, router settings, settings from the host, etc. It *should* just work bc the browser should know that the content has been updated.

    Before you upload the new file, at least delete the old weekly.pdf before uploading the new one. If you have server side cacheing on your site or server, obviously remove it.

    Dion

    (@diondesigns)

    You can add a “cachebuster” query string to the URL, maybe something like:

    $url .= '?v=' . filemtime('/path/to/pdf/file');

    The query string will change every time you update the file, and browsers will then download a fresh copy of the file.

    Thread Starter WPUser

    (@renik)

    @diondesigns thank you. Where can I add that code?

    Dion

    (@diondesigns)

    It would be added to wherever the URL to the PDF file is defined. It could be in your theme or in a plugin, or perhaps even in a widget or shortcode. You’ll need to do some detective work. If it’s in generic code that defines several (or all) URLs, you’ll need to check whether it’s the URL to the PDF file before adding the cachebuster query string.

    Good luck!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Disable caching for PDF?’ is closed to new replies.