Magento 2 Contact Form Attachment: Secure File Upload
SKU: CONTACTFORMATTACHMENT1
- File upload in the contact form with type and size limits
- Server-side MIME check, storage outside the web root
- Virus scan hook for your own scanner
- Automatic retention period for uploaded files
Einmaliger Kauf · inkl. 12 Monate Updates · zzgl. MwSt.
Magento 2 contact form attachment: why an upload is more than a field
A customer wants to send you a photo of a defective part, a prospect a technical drawing. The standard Magento contact form has no upload field for that. The Magento 2 contact form attachment module adds one and takes care of everything behind it: type and size validation, safe storage, notification and deletion.
A file upload is a classic attack surface. That is why the extension checks the file type on the server by content, stores files under random names outside the web root and offers a hook for your own virus scanner. The Magento 2 contact form attachment works in Hyvä shops with Alpine.js and without an additional script.
Magento 2 contact form attachment: screenshot, photo or PDF without a security hole
Customers send photos of defects, delivery notes or drawings. The module accepts them safely and makes them available to your team.
Upload in the form
One or more files directly in the contact form, also on smartphones.
Type and size limits
Allowed extensions, maximum size and number per request are configurable.
Real validation
The file type is checked on the server by content, not just by extension.
Safe storage
Stored outside the web root, with randomly assigned file names.
Virus scan hook
An interface to plug in your scanner, flagged files are rejected.
Retention period
Files are removed automatically after a configurable time.
Magento 2 contact form attachment: only allowed files make it through
The upload field appears in the contact form and lists the chosen files with name and size. Type and size are pre-checked in the browser (Alpine.js, no extra script), but the binding check always happens on the server. Visitors get instant feedback, and tampered requests still run into a wall.
- Allowed types such as PDF, JPG, PNG, DOCX are freely configurable
- Maximum size per file and total number per request
- Clear error messages in the language of the store view
Safe processing: files never end up unchecked in a public directory
Uploaded files are stored under random names outside the publicly reachable web root. Before saving, the module calls a virus scan hook: you can plug in your own scanner there, for example ClamAV. The module does not ship a scanner but the defined interface, and rejects files the scanner flags.
- Random file names, no execution in the web root
- Virus scan hook as an interface, scanner can be connected by arrangement
- Rejected uploads are logged without storing the content
Admin email, download link and retention for the contact form attachment
You choose whether the admin notification attaches the files directly or only contains a download link that requires an admin login. Large attachments then do not burden mailboxes. For GDPR you can show a privacy notice next to the upload field and set a retention period after which a cron job removes the files.
- Email attachment or download link after login
- Privacy notice text per store view
- Cron job deletes files after the configured period
Use cases for the Magento 2 contact form attachment
Wherever customers want to include documents instead of sending them later by email.
Complaint with photo
Customers attach a picture of the damage. Your support sees the request and the photo together and does not have to ask again.
Spare part enquiry
Rating plate, drawing or invoice copy as PDF or image: fewer follow-up questions for technical products.
B2B quote request
Bills of materials or specifications can be uploaded directly with the enquiry.
Application or consultation
Service providers receive documents immediately. The retention period makes sure they do not stay around indefinitely.
Contact form without attachment versus Magento 2 contact form attachment
The difference shows in everyday support work.
| Aspect | Without module | With module |
|---|---|---|
| Sending files | Only by reply email | Directly in the form |
| Type check | None | Server-side by content (MIME type) |
| Storage | Scattered across mailboxes | Outside the web root, random names |
| Virus check | Only in the mail system | Hook for your scanner before saving |
| Privacy | No retention period | Automatic deletion after the configured period |
Setting up the Magento 2 contact form attachment
-
1
Clarify requirements
Which file types, which sizes, which retention period? We agree on this with you.
-
2
Installation
We set up the upload field in the contact form and create the storage location outside the web root.
-
3
Connect a scanner
If you wish, we connect your virus scanner through the hook. A scanner is not part of the delivery.
-
4
Test and approval
We test allowed and rejected files and the admin email, then you enable the attachment.
Distinction from other Mironsoft modules
The Magento 2 contact form attachment only adds the file upload. Layout and additional form fields are handled by the existing contact form modules, attachments on orders by an order attachment module and attachments in transactional emails by another module. The extension can be combined with the contact form modules.
Merchants who use the Magento 2 contact form attachment keep their form as usual and only gain one additional, secured field. The Magento 2 contact form attachment stays optional per store view.
No download, but personal setup
Contact Form Attachment is not listed here as a ready-made download for self-installation. The purchase is a service order: after buying we contact you, set up the module and agree file types, sizes and the connection of a virus scanner together with you.
Frequently asked questions
Answers to typical questions about the Magento 2 contact form attachment.
Does the module include a virus scanner?
Is only the file extension checked?
Where are the files stored?
How do I deal with GDPR?
Does it work with my extended contact form?
How can I add a file upload to the Magento 2 contact form?
How can I limit file types and size for uploads in Magento 2?
Does the Magento 2 contact form attachment work with Hyvä?
What happens to rejected files?
Can I download and install the module myself?
Magento 2 contact form attachment – Mironsoft