File Uploads

The File Uploads add-on needs to be installed and activated to see the features mentioned in this this documentation.

  1. Adding and configuring a File Upload option for your users
  2. Attaching an uploaded file to an email
  3. Saving uploaded files to Dropbox or Amazon S3
  4. File Uploads General Settings
  5. Advanced functionality

Adding a File Upload option to your form

A File Uploads field can be added to the form by clicking on the Add Field Button on the bottom right, then choosing the File Upload field from the list.


Configuring your File Upload field

Click on the File Upload field to open its settings window.

General Settings


The name of the field as displayed to your users.

Required Field

If enabled, this field must be completed before the form can be submitted.

Save to Server

Enabled by default, this option will save an uploaded file to your server when the form is submitted.

Rename Uploaded File

If you want the file to retain the name your user gave it, leave this blank. If you prefer your own naming convention, enter it here. You can create directories using / in the name.
There are a number of different “shortcodes” supported for renaming, which can be found in the expandable section immediately below:

Renaming Conventions
%filename% – The file’s original filename, with any special characters removed.
%formtitle% – The title of the current form, with any special characters removed.
%username% – The WordPress username for the user, if they are logged in.
%userid% – The WordPress ID (int) for the user, if they are logged in.
%displayname% – The WordPress displayname for the user, if they are logged in.
%lastname% – The WordPress lastname for the user, if they are logged in.
%firstname% – The WordPress firstname for the user, if they are logged in.
%date% – Today’s date in yyyy-mm-dd format.
%month% – Today’s month in mm format.
%day% – Today’s day in dd format.
%year% – Today’s year in yyyy format.
%field_X% where X is the ID of the field you would like to use to rename the file. You can find the ID by viewing the form through the preview and using the Inspect Element on the field you would like to use.  Ex: If the ID is “nf-field-4”, you would use %field_4% .

Save to Media Library

If this setting is enabled, the File Upload will be save to the server’s Media Library.

Restrictions Settings

File Limit

Use this option to adjust the number of files that be uploaded from this File Upload field.

File Size Limit

Set the maximum size of the file that can be uploaded here. This setting defaults to MB. Your server also likely has a maximum file size limit, so if you set something here and users still cannot upload files of that size, contact your host to have the server file size limit increased.

Allowed File Types

This setting creates a whitelist of the types of files that can be uploaded by file extension (i.e. .pdf, .jpg, .png, .xls, etc). With data entered into this setting, users will be able to upload files of that type only.

Display Settings


Any text entered here will appear between the label and the field.

Select File Button Text

By default, the text that appears on the File Uploads button when viewing the form will read “Select Files”. That can be changed to whatever you like here.

Show Advanced Features

To see these features, you will need to enable Developer Mode in Ninja Forms’ settings.

Display Settings

Custom Class Names

  • Container: Text entered here applies a custom HTML class to this field’s wrapper
  • Element: Text entered here applies a custom HTML class to this field’s element

Help Text

Entering text here will display an informational icon next to the field label. When a user hovers over it, a small window will appear containing this text.

Advanced Settings

Label Position

Changes the orientation of the field label relative to the field element (above, below, left, right, hidden)

Administration Settings

Field Key

A unique programmatic key that can be used to identify and target your field for custom development. One is generated for each field automatically, and this is what you see pre-populated in the setting. It can be changed, though doing so will not update it in anything you’ve already written.

[Jump to top]

Attaching an uploaded file to an email

This can be accomplished in two ways, the first method via merge tag, which will then create a link to the file(s) uploaded in the received email.

Sending a download link with the email

  1. From the Emails and Actions tab, edit the email action by clicking on the action’s gear symbol. From here, click the merge tag button located in the Email Message line, shown below. 2. Add in the File Uploads merge tag to the Email Message body by simply clicking on it. Should your list show many merge tags, and you have trouble locating the correct tag, take advantage of the merge tag search bar and type File Uploads to locate the appropriate tag.

Attaching the file(s) to the email

The second method will attach the file(s) itself to the email itself.

  1. From the Emails and Actions tab, edit the email action by clicking on the action’s gear symbol.
  2. From the pull out drawer, scroll down to the Advanced tab and click to drop down.
  3. Then activate (click) the Attach File Uploads toggle.

[Jump to top]

Saving uploaded files to Dropbox or Amazon S3

This process requires 2 steps: 1) adjusting plugin settings and 2) adjusting form settings

1. Adjust your plugin settings to send uploaded files to an external service

Connecting Ninja Forms to Dropbox
To connect Ninja Forms to Dropbox, go to Ninja Forms > File Uploads > External Settings tab and click on the Connect button

Dropbox will create a default directory of Apps/NinjaFormsUploads within your Dropbox account. While this cannot be changed, you can use the File Path setting here to define a custom directory within that file path for this upload field.

Connecting Ninja Forms to Amazon S3
  1. Open the IAM console within your Amazon S3 account
  2. In the navigation pane, choose Users. Then choose your IAM user name.
  3. Choose the Security Credentials tab and then choose Create Access Key.
  4. To retrieve your Access Key and Secret Key, choose Show User Security Credentials.
  5. Choose Download Credentials, and store the keys in a secure location.
  6. Go to Ninja Forms > File Uploads > External Settings tab and enter your Access Key ID and Secret Access Key


2. Adjust your form to send uploaded files to an external service

Now that you have your plugin configured to send to either Dropbox or Amazon S3 (step 1), you need to add and configure an External File Upload action on the form itself. Open your form and navigate to the Emails & Actions tab, then click the blue circle/+ in the bottom right corner to add a new action.

Under the External File Upload Action, you can choose the service you would like the files from your form to save to.

[Jump to top]

File Uploads General Settings

Access these settings in your WordPress dashboard under Ninja Forms > File Uploads.

Browser Uploads

This tab allows you to view or delete all uploaded files that have been saved to your server. You can sort by form or by date.

Upload Settings

  • Max File Size (in MB) – The Max File Upload size allowed per form.
  • File upload error message – The Error Message that the user receives when the Max File Size is met.
  • Custom Directory – Is used to create dynamic directories.

If you migrate from another server and the File Uploads path is pointing to the older server location, you can deactivate then reactivate your File Uploads and Ninja Forms plugins to reset the file path.

Advanced Functionality

Please note that modifying your add-on with custom code is outside the scope of support that we are able to provide. However, this section provides solutions to highly specific use cases of File Uploads that may come in handy if you find yourself needing them!

Sending a direct link to the public URL of a file uploaded to Amazon S3

You can use the following code to send a direct link to the public URL for the uploaded file on Amazon S3:


Whitelisting file types that are allowed by File Uploads but not by WordPress

For security purposes, File Uploads only allows the upload of file types that WordPress allows. However, this list of file types can be amended with the ‘ninja_forms_upload_mime_types_whitelist’ filter:

Alternatively you can deactivate this type checking if you are whitelisting extensions in the field setting using this filter: