Support » Plugin: Protect WordPress Uploads » Can’t view protected files in a browser

  • Resolved Dave

    (@dcutri500)


    I have a locked (protected) PDF file. If you are not logged in, then clicking the link (https://mydomain.com/download/file/7629/) forces you to log in. Once you are logged in, then you can click the file to open it, but all it does is download to my computer, it doesn’t open in a new tab, like the normal, unprotected WordPress URL would. This is in Chrome. Firefox gives you the option to open it in your browser or download it, but Chrome has no such option. Is there any way I can get the protected URL to open in a new tab instead of immediately downloading? Thanks for any help.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • I have the same issue.

    We need to show pdf documents inline instead of downloading them by setting headers Content-Type: application/pdf and Content-Disposition: inline.
    I looked at the PWPF_handle_private_download function and it seems easy to conditionally set these headers if filename ends with .pdf, but can this function be overridden easily with our own code?

    I’d be happy to supply a merge request

    Plugin Author csorbamedia

    (@csorbamedia)

    Dear,

    I have created in such a way that it downloads directly.
    I understand for PDF some people want to open in their browser instead of downloading.

    As @macsolve said you can change the headers of the PWPF_handle_private_download function and add some conditional to it.

    As it is open source you are free to change the code to your needs.

    Stephan

    Not really comfortable to change the code of a published plugin since changes are gone when plugin is updated

    discgosforth

    (@discgosforth)

    Might be the only option…..
    Do you have the code I can try?
    I’m thinking that if I display the pdf first users can decide to download/save a copy from their browser. Best of both worlds!

    Plugin Author MAUWEN

    (@mauwen)

    Dear all,

    I will take it in consideration to add this as an option in a new release.

    Stephan

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.