12/30/16

Using the Path File module to manage files in Drupal 8

Manage files in Drupal with Path File image

Let's face it, managing files in Drupal can be difficult.  Content pages have a whole suite of functionality including custom URLs, publishing status, revisions, and translations (there's actually even MORE, but you get my point).  Files, however, lack most of that functionality even though many websites use files (specifically pdfs) side by side with standard pages.  These documents often contain specific legal language and must be available at canonical URLs so they can be included in website content, printed marketing materials, etc.

Out of the box, Drupal won't replace an uploaded file on the server, it will simply rename it to avoid overwriting an existing file.  Let's say for example your law firm uploaded it's privacy policy to Drupal.  By default, you would be able to view it at something like www.bob-loblaw.com/sites/default/files/privacy-policy.pdf. 

Cool. Later on, you want to publish an update to the policy, so you re-upload the file, only to find that the URL is now www.bob-loblaw.com/sites/default/files/privacy-policy_0.pdf.  This isn't a huge deal...unless your site's content, the internet in general, and the 10,000 pamphlets you printed all point to the OLD URL and the outdated document.

Enter the Path File Module for Drupal 8, which we developed at Bowst to solve this very problem.  By treating files a bit more like content, we provide a more robust management experience for site managers who would like to display PDFs and other files at specific URLs.  Site managers can also publish/unpublish files and specify permissions which provides fine-tuned control over who can access your files.

We've published the module on Drupal.org, you can check it out here: https://www.drupal.org/project/path_file.

Need help with your next Drupal project?

Click on that button and fill in the simple form.