Not yet using the Miniform Form Creator? Try it now
Do you like this free module? Please consider a small donation through PayPal

File uploads

Since version 0.6 it is possible to allow fileuploads in your forms.
Files are only sent as attachments in the email that is sent, they are not stored on your webserver!
 

Form requirements

For file uploads the form will need to have an encoding type set to multipart/form-data.
The standard form setup should be:

<form name="form_{SECTION_ID}" id="form_{SECTION_ID}" method="post" action="{URL}" enctype="multipart/form-data">

The input type for file uploads is "file". For the rest all the rules for inputfields (as described earlier) apply.
The following line will add a file upload (browse) button to your form.

<input class="{RESUME_ERROR}" type="file" id="resume" name="mf_r_resume" value="{RESUME}" />

 

Filetype restrictions

By default, the miniform module will allow the following file extensions to be uploaded.
jpg, jpeg, gif, png, zip, rar, 7z, pdf, doc, docx, xls, xlsx, csv

If you need to change this to something else you can use a special formfield for this.
Just add anywhere in your form template the label WHITELIST followed by the file extenstions you want to allow. The included Job application demo template uses {WHITELIST doc,docx,odt,pdf,rtf,txt}

 

Filesize checks

If you want to do some javascript checks to prevent large uploads that will fail, you can use a special label {UPLOAD_LIMIT} that will give a number representing the current limits of your server in Mb's.
The demo template has a small javascript included that will perform this check.