Jump to content

Make file uploads unavailable for unpublished / deleted pages

Recommended Posts

Sorry if it was covered, I haven't found an answer by searching in Google or on the forum.
The client is an estate agency and they want that all images, pdf brochures etc… would disappear from their site when they unpublish or delete a property page.

Is that only possible with a custom module that hooks into unpublish or delete? It seems that ProcessWire doesn't delete the folder associated with the page from assets/files/ automatically. Similarly, if the page is unpublished, file uploads are still publicly available with the direct url.
As a result, Google would keep them in their index forever giving false results.

I understand that images can be used elsewhere in the site so it makes sense to keep them available, however since images/files belong to a page, keeping their public status synced could also make sense.
Any suggestion is welcome, maybe I haven't thought of something else.

Share this post

Link to post
Share on other sites

From $config->pagefileSecure https://processwire.com/api/ref/config/ - When used, files in /site/assets/files/ will be protected with the same access as the page. Routines files through a passthrough script.

I haven't used this yet, but there might be a performance hit?  I'm not sure how much though?

From here Wanze writes:



If you enable the pagefileSecure, requets to serve files from /site/assets/files are not delivered directly by the webserver but routed through ProcessWire, which does the permission checks. So it slows down the delivery of the files, because they are served by PHP.

If you only need to secure specific files, you could also try the SecureFile module: http://modules.processwire.com/modules/fieldtype-secure-file/
It is an extension of a regular file field with the possibility to customize the storage location - here you would typically choose a folder outside the web root.



  • Like 3

Share this post

Link to post
Share on other sites

Thanks, that is brilliant, multiple solutions for the same problem, built right into the core. PW just keeps giving. 🙂

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...