Users Not Able to Upload Files Wordpress
The File Uploads add-on needs to exist installed and activated to see the features mentioned in this this documentation.
- Adding and configuring a File Upload pick for your users
- Attaching an uploaded file to an email
- Saving uploaded files to Dropbox, Google Drive, or Amazon S3
- File Uploads General Settings
- 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.
d
General Settings
Label
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 adopt your own naming convention, you can enter it here using the merge tag button.
There is a {file:extension} merge tag, but that doesn't have to be added to the stop of the setting every bit it will exist added automatically.
The {file:proper name} and {file:extension} merge tags are only used the field settings and tin can't be used in actions or other places. You can also create directories using / in the name.
The erstwhile fashion "shortcodes" are notwithstanding supported for renaming and can exist mixed with merge tags. These shortcodes can be plant in the expandable department 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'due south date in yyyy-mm-dd format.
%month% – Today's month in mm format.
%day% – Today's mean solar day in dd format.
%year% – Today's year in yyyy format.
Save to Media Library
If this setting is enabled, the File Upload will be saved to the server'southward Media Library.
You tin can retrieve data most the attachment created in the media library using the post-obit merge tags:
{field:my_field_key:attachment_id} – the ID of the attachment
{field:my_field_key:attachment_url} – the URL of the attachment
{field:my_field_key:attachment_embed} – an HTML image of the zipper
Restrictions Settings
File Limit
Utilize this choice to conform the number of files that be uploaded from this File Upload field.
Maximum File Size
Fix the maximum size of the file that can be uploaded hither. This setting defaults to MB. Your server also likely has a maximum file size limit, so if you prepare something here and users however cannot upload files of that size, contact your host to accept the server file size limit increased.
Minimum File Size
Set the minimum size of the file that can exist uploaded here. This setting defaults to MB
Allowed File Types
This setting creates a whitelist of the types of files that can be uploaded by file extension (i.due east. .pdf, .jpg, .png, .xls, etc). With data entered into this setting, users volition be able to upload files of that blazon only.
Display Settings
Description
Any text entered here will appear between the label and the field.
Select File Push Text
By default, the text that appears on the File Uploads button when viewing the form will read "Select Files". That can be inverse to whatever you like hither.
Bear witness Advanced Features
To run across these features, you will need to enable Developer Style in Ninja Forms' settings.
Display Settings
Custom Grade Names
- Container: Text entered here applies a custom HTML class to this field'southward wrapper
- Chemical element: Text entered hither applies a custom HTML class to this field's element
Aid Text
Entering text here will display an advisory icon next to the field characterization. When a user hovers over information technology, a modest window volition appear containing this text.
Advanced Settings
Label Position
Changes the orientation of the field label relative to the field chemical element (above, below, left, correct, hidden)
Assistants Settings
Field Cardinal
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 run across pre-populated in the setting. It tin can be changed, though doing and so will not update information technology 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 volition then create a link to the file(s) uploaded in the received email.
Sending a download link with the email
- From the Emails and Actions tab, edit the email action by clicking on the action'due south gear symbol. From here, click the merge tag button located in the Email Message line, shown below.
Attaching the file(south) to the e-mail
The second method will adhere the file(southward) itself to the e-mail itself.
- From the Emails and Actions tab, edit the e-mail action by clicking on the action'due south gear symbol.
- From the pull out drawer, scroll downwardly to the Advanced tab and click to drop downward.
- Then actuate (click) the Attach File Uploads toggle.
[Jump to meridian]
Saving uploaded files to Dropbox, Google Drive, or Amazon S3
This procedure requires ii steps: 1) adjusting plugin settings and 2) adjusting course settings
ane. Setup your plugin settings to send uploaded files to an external service
ii. Setup your form to send uploaded files to an external service
Now that you lot accept your plugin configured to transport to either Dropbox or Amazon S3 (step i), you need to add together and configure an External File Upload action on the form itself. Open up your course and navigate to the Emails & Actions tab, and so click the blueish circumvolve/+ in the bottom right corner to add together a new action.
Under the External File Upload Activeness, you can choose the service you would like the files from your course to save to.
[Bound to top]
File Uploads Full general Settings
Access these settings in your WordPress dashboard nether Ninja Forms > File Uploads.
Browser Uploads
This tab allows y'all to view or delete all uploaded files that have been saved to your server. You can sort by form or by engagement.
Upload Settings
- Max File Size (in MB) – The Max File Upload size immune 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 drift from another server and the File Uploads path is pointing to the older server location, you tin deactivate then reactivate your File Uploads and Ninja Forms plugins to reset the file path.
Advanced Functionality
Delight note that modifying your addition with custom code is outside the scope of support that nosotros are able to provide. Nonetheless, this section provides solutions to highly specific utilise cases of File Uploads that may come up in handy if you find yourself needing them!
Sending a direct link to the public URL of a file uploaded to External Services
To enable a direct link to the public URL for the uploaded file on Dropbox, Google Drive, or Amazon S3, turn on 'Use Public URL' setting in Ninja Forms > File Uploads > External Settings
Allowing file types in File Uploads that are not normally allowed by WordPress
For security purposes, File Uploads simply allows the upload of file types that WordPress allows. Nevertheless, this list of file types can exist amended with the 'ninja_forms_upload_mime_types_whitelist'
filter.
If Allowed File Blazon is Setup If Allowed File Type is not Setup
Add to functions.php
add_filter( 'ninja_forms_upload_mime_types_whitelist', 'my_ninja_forms_upload_mime_types_whitelist' );
function my_ninja_forms_upload_mime_types_whitelist( $types ) {
//$types['esx'] = 'awarding/octet-stream';
return $types;
}
add_filter( 'ninja_forms_upload_check_mime_types_whitelist', '__return_false' );
Copy & paste both the function and the filter if you lot fix the allowed file types – File Uploads > Restrictions > Allow File Types – within the File Uploads field of your grade.
Include add_filter( 'ninja_forms_upload_mime_types_whitelist', 'my_ninja_forms_upload_mime_types_whitelist' );
function my_ninja_forms_upload_mime_types_whitelist( $types ) {
return $types;
}
Note: The WordPress uploads folder is accessible by default on WordPress installations. To limit access to the WordPress Uploads folder, you may want to use an .htaccess file.
File Upload Improver Tutorials!
Source: https://ninjaforms.com/docs/file-uploads/
Post a Comment for "Users Not Able to Upload Files Wordpress"