=== Multiple File Upload for Contact Form 7 ===
Contributors: hell0bunny
Donate link: https://profiles.wordpress.org/hell0bunny/
Tags: contact form 7, file upload, multiple files, drag and drop, attachments
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Drag-and-drop multiple file uploads for Contact Form 7, with per-form storage, custom folders, and clickable email links.

== Description ==

Give any Contact Form 7 form a clean multiple-file field. Visitors drag files in or click to browse. You control the button text, file types, size limits, and where each form stores uploads.

**Upload that feels easy**

* Drag and drop, or click the browse button
* Several files in one field — no extra `[file]` tags
* Custom button label (default: Choose files) and CSS class
* Optional or required: `[hbwa_mfile]` / `[hbwa_mfile*]`
* Limits you set: file types, size per file, and max number of files

**Save files your way — per form**

Each form has its own **Multi-file Upload** tab. Turn saving on only where you need it.

* **Media library** — add uploads to WordPress Media
* **Folder under wp-content** — keep files in a path you choose, such as `uploads/invoices`

**Folders that stay organized**

When you save under wp-content, pick how subfolders are created:

* By year
* By year / month (same idea as the WordPress media library)
* By year / month / day
* By logged-in user
* By user / year
* By form name (slug, for example `contact-form-1`)
* Custom pattern, such as `{year}/{form_slug}`

Name saved files with tokens like `{filename}`, `{date}`, `{time}`, and `{random}`. The original extension is always kept.

**Email that is ready to open**

* Attach files in the Mail tab with the matching mail-tag, for example `[attachments]`
* Put the same tag in the message body
* When saving is on, that tag becomes a **link to open each file** instead of a plain name

**Built for Contact Form 7**

* **multi-file** button in the form-tag generator
* Works with Mail and Mail (2)
* Settings apply to that form only — other forms stay unchanged

**Requirements**

* [Contact Form 7](https://wordpress.org/plugins/contact-form-7/) must be installed and active

== How to use the shortcode ==

1. Edit a Contact Form 7 form.
2. Click the **multi-file** button in the form-tag generator.
3. Set the field name, button label, CSS class, file types, size limit, and max files, then insert the tag.
4. In the **Mail** tab, add the same field name under **File attachments** (for example `[attachments]`).
5. Optionally add the same mail-tag in the message body.
6. Open the **Multi-file Upload** tab if you want to keep copies: enable **Save uploaded files**, then choose Media library or a folder under wp-content.

**Basic shortcode examples**

Optional field:

`[hbwa_mfile attachments]`

Required field:

`[hbwa_mfile* attachments]`

Custom button label and class:

`[hbwa_mfile* attachments class:my-upload-btn "Select files"]`

With options:

`[hbwa_mfile* attachments filetypes:jpg|jpeg|png|pdf|doc|docx limit:2mb maxfiles:5 "Choose file"]`

**Shortcode options**

* Quoted value — browse button label (default: Choose files)
* `class:` — CSS class added to the file input and the browse button
* `filetypes:` — pipe-separated extensions (example: `jpg|jpeg|png|pdf`)
* `limit:` — max size per file (example: `2mb`, `500kb`, or bytes)
* `maxfiles:` — maximum number of files allowed in one submission

**Save files (per form)**

On the form’s **Multi-file Upload** tab:

1. Enable **Save uploaded files**.
2. Choose **one** destination:
    * **Media library**
    * **Folder under wp-content** — base path relative to `wp-content` (for example `uploads/invoices`), then organize subfolders by year, month, user, form name slug, or a custom pattern
3. Optional **File name** pattern (default `{filename}`). The original extension is always kept.

When saving is enabled, the mail-tag in the message body outputs links to open each file.

Uploaded files are sent as real email attachments when Contact Form 7 file uploading is enabled for that mail template. Make sure your hosting PHP upload limits (`upload_max_filesize`, `post_max_size`) allow the sizes you configure.

**Guidelines**

* Always put the matching mail-tag in **File attachments** if you want files attached to the email.
* Use `[hbwa_mfile*]` when at least one file is required.
* Keep `maxfiles:` and `limit:` realistic for your server and mailbox size limits.
* Restrict `filetypes:` to what you actually need (for example images and PDFs only).
* This field does not replace CF7’s native `[file]` tag — use `[hbwa_mfile]` when you need multiple files and drag-and-drop.

Author: [hell0bunny](https://profiles.wordpress.org/hell0bunny/)

== Installation ==

1. Upload the `bunny-co-multiple-file-upload-cf7` folder to `/wp-content/plugins/`
2. Activate **Multiple File Upload for Contact Form 7** through the **Plugins** screen
3. Make sure Contact Form 7 is installed and active
4. Edit a Contact Form 7 form
5. Click the **multi-file** button in the form-tag generator
6. Insert the tag into the Form tab
7. Add the matching mail-tag to the Mail tab **File attachments** field (and optionally the message body)
8. Optional: open the form’s **Multi-file Upload** tab to save files to the media library or a `wp-content` folder

== Screenshots ==

1. Multi-file form-tag generator in the Contact Form 7 editor
2. Frontend contact form with the drag-and-drop upload field
3. Selected files list with remove controls and file count
4. Submitted files attached to the Contact Form 7 notification email
5. Mail tab showing the multi-file mail-tag in the message body and File attachments fields
6. Per-form Multi-file Upload settings: save to the media library or a wp-content folder, organize by form name, and set the saved file name

== Frequently Asked Questions ==

= Are uploaded files attached to the email? =

Yes. Add the field’s mail-tag (for example `[attachments]`) to the Mail tab **File attachments** box. Contact Form 7 will attach the uploaded files to the notification email. Place the same mail-tag in the message body to show file names, or openable links when **Save uploaded files** is enabled on that form.

= How do I make the upload required? =

Use the required form-tag: `[hbwa_mfile* your-field-name ...]`.

= How do I change the Choose files button text? =

In the tag generator, set **Button label**. If you leave it empty, the button shows “Choose files”. Example: `[hbwa_mfile attachments "Select files"]`.

= Where are files stored? =

By default they stay in Contact Form 7’s temporary folder and are attached to the email. On the form’s **Multi-file Upload** tab, enable **Save uploaded files** and choose the media library or a folder under `wp-content`. You can organize that folder by year, month, user, or the form name slug.

= Can each form save files differently? =

Yes. Saving, destination, folder layout, and file name are set on that form’s **Multi-file Upload** tab only.

== Changelog ==

= 1.1.0 =
* Custom browse button label and class
* Per-form save option: media library or a folder under wp-content
* Organize saved folders by year, month, user, form name slug, or custom tokens
* Custom saved file names
* Mail-tag outputs file links when saving is enabled

= 1.0.0 =
* Initial release: `[hbwa_mfile]` multi-file field with drag-and-drop, limits, and CF7 mail attachment support

== Upgrade Notice ==

= 1.1.0 =
Adds custom button labels and per-form file saving (media library or wp-content folder), with mail-tag file links.

= 1.0.0 =
Initial release.
