=== BRC File Manager ===
Contributors: brclabs
Tags: file manager, file upload, file directory, file away alternative, s3 upload
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Complete WordPress file management: drag-drop uploads, File Away-style directories, S3/R2 offload, file requests, bulk zip, webhooks. Bundled — no add-on tax.

== Description ==

BRC File Manager is the complete file plugin WordPress should have. It combines a drag-and-drop frontend uploader, a File Away-style directory browser, cloud storage offload to S3/R2/Wasabi/DO Spaces/B2/Dropbox, public file-request links, bulk zip download, and webhooks — all in one plugin, one license, one settings page.

It's a drop-in replacement for the abandoned File Away plugin (~100K installs, closed March 2023) and ships a one-click migration importer so refugees can move over without reconfiguring everything from scratch.

= Why this plugin exists =

Most paid file plugins charge extra for every individual feature — drag-drop, cloud storage, guest uploads, quotas, file directories, share links. We bundle them all in one plugin at a flat price, with a renewal-price lock pledge: the price you pay at signup is the price you'll pay forever.

= Free features =

* Drag-and-drop frontend file upload (block + shortcode)
* File-type and size restrictions
* Per-role upload permissions
* Saves to WordPress media library
* Real MIME-type validation (extension spoofing protection)
* File directory listing — browse a server folder as a clean, sortable file index (block + shortcode)
* `[fileaway]` shortcode compatibility alias for File Away migration
* One-click migration importer from File Away 3.x

= Pro features =

* **Cloud storage offload** — S3 / R2 / Wasabi / DigitalOcean Spaces / Backblaze B2 / Dropbox destinations
* **Guest (logged-out) uploads** to any configured destination
* **Per-role storage quotas** with a per-user usage ledger
* **Frontend file listing block** — show each logged-in user their own uploads with optional delete
* **Chunked uploads** for files larger than the configured threshold (bypasses PHP `upload_max_filesize`)
* **Email notifications** on upload (admin + uploader), optionally with the file attached
* **Pro directory features** — folder restriction rules (per-role/per-user), share links with expiration, download analytics, file preview pane, search/filter UI, embeddable iframe views
* **File request links** — Dropbox-style "send me a file" public links. Configurable per-link expiry, max-uses, allowed file types, file-size cap, optional email requirement
* **Bulk zip download** — multi-select files in a directory listing, download as one zip; honors per-file role/folder permissions
* **Webhooks** — POST a JSON payload to a customer-configured URL on file events (upload, delete, optionally download). Per-webhook HMAC-SHA256 signing secret; retry-on-failure queue

Get a Pro license at [brclabs.io](https://brclabs.io/plugins/file-manager).

= Migrating from File Away =

File Away ([wordpress.org/plugins/file-away](https://wordpress.org/plugins/file-away/)) was a popular file-browser plugin shut down in March 2023 for security issues. BRC File Manager ships a one-click migration importer at **BRC Labs → Migrate from File Away** that reads File Away's folder configurations and shortcodes and rehydrates them into BRC File Manager. The migration is non-destructive — File Away's data stays in your database after migration, and a rollback action is available for 7 days.

The `[fileaway]` shortcode keeps working too — BRC File Manager registers it as a compatibility alias so existing posts render correctly even if you don't run the migration immediately.

= 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. We build plugins the way we build everything: clean, focused, and built to last. Our pledge: the price you pay at signup is the price you'll pay forever.

== Installation ==

1. Upload the plugin to `/wp-content/plugins/brc-file-manager/` or install through the WordPress plugin directory.
2. Activate via the Plugins menu.
3. Go to **BRC Labs → File Manager** in the admin sidebar to configure file types, size limits, roles, and directory base path.
4. Add a frontend uploader via the **BRC File Manager** block or shortcode: `[brc_file_upload]`
5. Add a directory browser via the **BRC File Directory** block or shortcode: `[brc_file_directory dir="reports"]`

== Frequently Asked Questions ==

= Does this replace File Away? =

Yes — directly. The migration importer at **BRC Labs → Migrate from File Away** moves your folder configurations and post-embedded shortcodes over in one click. The `[fileaway]` shortcode is registered as a compatibility alias so nothing breaks during the transition.

= What S3-compatible services are supported? =

Anything that speaks AWS Signature V4: AWS S3, Cloudflare R2, Wasabi, DigitalOcean Spaces, Backblaze B2 (S3 endpoint), MinIO, Linode Object Storage, and most others.

= Can guests (logged-out users) upload? =

Yes, with a Pro license. The free version requires users to be logged in. **File request links** (Pro) are the recommended path for letting outsiders send you files without an account — generate a token-protected link, share it, receive the upload.

= What happens if my Pro license expires? =

The plugin keeps working at the free feature set — uploads still work to the WordPress media library, the directory listing still renders, the `[fileaway]` compatibility shortcode keeps firing. Pro-only features (cloud storage, share links, bulk zip, webhooks, file request links) become inactive until the license is reactivated. No data is lost.

= How are webhooks secured? =

Every webhook delivery includes an `X-BRC-File-Manager-Sig: sha256=...` header — an HMAC-SHA256 hash of the request body using the per-webhook signing secret you receive when you create the webhook. Verify it on your receiving server to confirm the request came from your site.

== Changelog ==

= 1.0.0 =

Major release — merges what were previously BRC File Uploads (v0.4) and BRC File Directory (v0.2) into a single plugin: BRC File Manager. Shared storage adapters, MIME validation, permissions, quota tracking, and frontend listing UI.

New v1.0 features:

* **File Away one-click migration importer** with detect / map / run / rollback wizard at **BRC Labs → Migrate from File Away**. Reads `fileaway_*` options and embedded `[fileaway]` shortcodes; converts them to `[brc_file_directory]` blocks/shortcodes. Non-destructive (original File Away data preserved); 7-day rollback.
* **File request links** (Pro) — Dropbox-style public upload links. Per-link expiry, max-uses, file-type allowlist, file-size cap, optional email requirement. Admin UI at **BRC Labs → File Request Links**.
* **Bulk zip download** (Pro) — select multiple files in any directory listing and download as one zip. Streaming `ZipArchive` build; per-file permission revalidation.
* **Webhooks** (Pro) — POST a JSON payload to customer URLs on file events. HMAC-SHA256 signing, retry queue, admin UI at **BRC Labs → Webhooks**.

Carried forward from BRC File Directory v0.2:

* Local + S3-backed file scanners (FileScanner, RemoteFileScanner, S3Client)
* Path validator with directory-traversal protection
* Folder access rules (Pro) — per-role and per-user folder restrictions
* HMAC-signed share links (Pro)
* Download analytics + log
* `[fileaway]` shortcode compatibility alias

Carried forward from BRC File Uploads v0.4:

* Drag-drop uploader with block + shortcode
* S3 / R2 / Wasabi / DO Spaces / B2 / Dropbox storage adapters
* Per-role storage quotas
* Chunked uploads for large files
* Email notifications on upload (with optional file attachment)
* Frontend file listing block with copy-link, file-type icons, quota indicator, bulk delete, pagination

= 0.4.0 (BRC File Uploads, pre-merge) =

* Pro: email notifications can now attach the uploaded file itself.

= 0.3.0 (BRC File Uploads, pre-merge) =

* Listing: copy-link button, per-row file-type icons, quota indicator, bulk delete, pagination, auto-refresh.
* Admin menu: all BRC Labs plugins now register as submenus under a single shared "BRC Labs" menu.

= 0.2.0 (BRC File Uploads, pre-merge) =

* Pro: Dropbox storage adapter, per-role quotas, frontend listing block, chunked uploads, email notifications.

= 0.2.0 (BRC File Directory, pre-merge) =

* Pro: folder restriction rules, share links with expiration, download analytics, S3-backed scanner.

= 0.1.0 =

* Initial release of each pre-merge plugin.

== Upgrade Notice ==

= 1.0.0 =

Merges BRC File Uploads + BRC File Directory into a single plugin. New v1.0 features: File Away one-click importer, file request links (Pro), bulk zip download (Pro), webhooks (Pro). After updating, deactivate the legacy BRC File Uploads and BRC File Directory plugins if you have them installed.
