=== BRC File Uploads ===
Contributors: brclabs
Tags: file upload, upload form, frontend upload, user uploads, drag and drop
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Let visitors and members upload files from the front end. Drag-and-drop block or shortcode, with file-type limits and per-role permissions.

== Description ==

BRC File Uploads adds a front-end upload form to any page, post, or widget area — as a Gutenberg block or a shortcode. Visitors drop a file in, the plugin validates it, and it lands in your WordPress media library.

It is built for the everyday cases: collecting job applications, letting members submit documents, gathering photos for a competition, or accepting artwork from clients.

= What it does =

* **Drag-and-drop upload form** — block (`BRC File Upload`) or shortcode (`[brc_file_upload]`)
* **File-type allowlist** — decide exactly which extensions you accept
* **File-size limits** — per-file cap you control
* **Per-role permissions** — choose the minimum role allowed to upload
* **Real content validation** — the file's actual contents are checked against its extension, so a script renamed to `.jpg` is rejected
* **Goes to your media library** — uploads appear in Media like any other attachment, with an optional dedicated subfolder
* **Appearance settings** — accent colour, corner rounding, width, text size, and density, with no CSS required

= What it deliberately does NOT do =

This plugin **receives** files. It does not browse, manage, edit, or serve your server's filesystem. There is no directory browser, no configurable base path, and no endpoint that reads an arbitrary path from disk. Uploads are handed to WordPress's own media handling, and any list the plugin shows is drawn from its own database records rather than by scanning folders.

That boundary is intentional: it keeps the plugin's reach small and predictable.

= Pro features =

* **Cloud storage** — send uploads to S3, Cloudflare R2, Wasabi, DigitalOcean Spaces, Backblaze B2, or Dropbox instead of the media library
* **Guest uploads** — accept files from logged-out visitors
* **Per-role storage quotas** with a per-user usage ledger
* **"My uploads" listing block** — show each logged-in user their own uploads, with optional delete
* **Chunked uploads** — send files larger than your server's `upload_max_filesize`
* **Email notifications** on upload, to the admin and/or the uploader, optionally with the file attached
* **File request links** — generate a "send me a file" link anyone can use without an account. Per-link expiry, maximum uses, allowed types, size cap, and optional email requirement
* **Webhooks** — POST a signed JSON payload to your own URL when a file arrives

Get a Pro license at [bluerayconcepts.com](https://www.bluerayconcepts.com/brclient/cart.php?a=view).

= Security =

Uploads are the most sensitive thing a plugin can accept, so the defences are documented openly in `SECURITY.md`, shipped with the plugin. In summary:

* Extension allowlist intersected with WordPress's own permitted MIME types
* A hard denylist of executable and browser-executed types (`.php`, `.phar`, `.shtml`, `.html`, `.hta`, …) that overrides any allowlist
* File contents are inspected and must agree with the extension — and this check **fails closed**, rejecting rather than allowing when it cannot verify
* Chunked uploads track actual bytes received and bind each session to a secret
* Outbound requests to any URL you configure are validated against private, loopback, and cloud-metadata address ranges

= About BRC Labs =

BRC Labs is the WordPress plugin division of [Blue Ray Concepts](https://www.bluerayconcepts.com/), a design and web studio operating for 30+ years.

== External services ==

The free version makes **no external calls at all**. Nothing is contacted unless you enter a Pro license key.

If you activate a Pro license, the plugin contacts BRC Labs / Blue Ray Concepts servers for licensing only:

**1. License validation** — `https://www.bluerayconcepts.com/brclient/`
Confirms your key is valid. Contacted when you click Activate, and once daily thereafter while a key is stored. Sends: the license key, your site's domain, your server's IP address, and the plugin version.

**2. License entitlement hook** — `https://bluerayconcepts.com/wp-json/brc-hook/v1/`
Keeps Pro unlocked while your license is valid, with a short offline grace window.

* `/handshake` — sends your license key, site domain, and server IP.
* `/scan` — when a file is uploaded on a licensed site, sends a one-way SHA-256 fingerprint of the file so known-bad files can be flagged. The file, its name, and its contents are never sent — only the hash.

Data sent to these services is handled under BRC Labs' policies:

- Terms: https://bluerayconcepts.com/terms-and-conditions/
- Privacy: https://bluerayconcepts.com/privacy-policy/

Cloud storage destinations (S3, R2, Wasabi, DigitalOcean Spaces, Backblaze B2, Dropbox) and any webhook URL are third-party services **you choose and configure** with your own credentials; the plugin contacts them only when you enable them.

== Installation ==

1. Upload the plugin to `/wp-content/plugins/brc-file-uploads/`, or install it through the WordPress plugin directory.
2. Activate it via the Plugins menu.
3. Go to **BRC Labs → File Uploads** to set your allowed file types, size limit, and minimum role.
4. Add an upload form with the **BRC File Upload** block, or the shortcode `[brc_file_upload]`.

== Frequently Asked Questions ==

= Where do uploaded files go? =

Into your WordPress media library, exactly like a file uploaded through the admin. You can optionally route them into a dedicated subfolder. With a Pro license you can send them to a cloud bucket instead.

= Can logged-out visitors upload? =

Yes, with a Pro license. The free version requires users to be logged in. For collecting files from people without accounts, **file request links** (Pro) are usually the better fit — you generate a private link, share it, and receive the upload.

= Can someone upload a PHP file and hack my site? =

No. Executable extensions are blocked by a hard denylist that overrides your allowlist, the allowlist itself is intersected with WordPress's own permitted types, and the file's real contents are checked against its extension. A PHP script renamed to `.jpg` is rejected on content.

= Does it let me browse or manage files on my server? =

No, deliberately. This plugin only receives files. If you need a file browser, this is not that plugin.

= What happens if my Pro license expires? =

The plugin keeps working at the free feature set. Uploads still work to the media library. Pro-only features become inactive until you reactivate. No data is lost.

= Can I change how it looks? =

Yes — the Appearance settings cover accent colour, corner rounding, maximum width, text size, and layout density. For finer control, override the plugin's CSS custom properties (`--brc-fu-*`) from your theme.

== Screenshots ==

1. The upload block on a page, mid-upload.
2. Settings — file types, size limit, and role permissions.
3. Appearance settings.
4. File request links (Pro).

== Changelog ==

= 1.0.0 =

First release.

BRC File Uploads is the front-end upload half of BRC File Manager, released as a focused standalone plugin. It carries that project's full security hardening from the outset:

* Signed, expiring tokens for any generated link
* Extension allowlist intersected with WordPress's permitted MIME types, plus a hard denylist for executable and browser-executed types
* Content verification that fails closed
* Chunked uploads with cumulative byte accounting and per-session secrets
* A protected upload staging directory
* SSRF-validated outbound requests
* Write-only credential fields in the admin

== Upgrade Notice ==

= 1.0.0 =

First release.
