Digital Sovereignty for everyone

LH Private Uploads

LH Private Uploads keeps private files private. WordPress normally leaves every upload in the public uploads directory, so the file behind a private post or attachment can still be fetched by anyone who has, or guesses, its URL. This plugin moves those files into a directory outside the web root and serves them through WordPress, checking who is asking before a single byte is sent.

How it works

  • Status decides location. When an attachment, or the post it is attached to, becomes private or password protected, the file and all its image sizes move to the private directory. When it becomes public again, they move back. Other statuses can be added with the lh_private_uploads_protected_statuses filter.
  • Files are served through a proxy. Protected files get a /protected-files/ URL. Each request is matched to its attachment and checked before the file is streamed, with X-Sendfile support for large files.
  • Access is default deny and filterable. Out of the box, editors, the file’s uploader and the author of the post it belongs to can open a private file, and password-protected files show a password form. Other plugins grant access through the lh_private_uploads_user_can_access filter.
  • Built for multisite. Each site keeps its private files in its own directory, mirroring the public uploads layout, and a site only ever serves its own files. Files are never overwritten when they move.

The private directory defaults to private-uploads one level above the WordPress root and can be set with the LH_PRIVATE_UPLOADS_DIR constant. There are no settings to configure.

If you like this plugin please consider making a donation to further development

Install LHero.org

lhero.org

Open it straight from your home screen, full screen and quicker to load.

  1. Tap the Share button . If you cannot see it, tap ••• first.
  2. Scroll down and tap Add to Home Screen.
  3. Tap Add.
  1. Tap the browser menu â‹®.
  2. Tap Install app or Add to Home screen.
  1. In the menu bar, choose File, then Add to Dock.

Use your browser's menu to install this site or add it to your home screen.