Email. hello@digitalelite.co.uk | Tel. 020 8050 1385

File Upload

The file upload shortcodes allows you to add the capability for any site visitors to upload files to designated folders and directories. Visitors can 'click to upload' or drag files onto the upload area. Once the upload reaches 100% the progress bar displays "Upload Complete". This message displays for 1.5 seconds and then disappears.

Examples

To start using the file upload functionality use:

 wpmedia_upload=""

Upload to single folder:

wpmedia_upload folder="your-folder/your-subfolder"

Select folder to upload to:

wpmedia_upload folder="client 1, client 2, client 3"

Usage

The wps3files_upload shortcode supports several options:

  • Root (if allowed globally)
  • Single Folder
  • Comma Separated List of Folders (displays a folder picker)
  • Any Folder (displays a folder picker), only allows root if globally allowed

If the folder parameter is empty, you will be asked to choose the folder from a popup when you upload a file. If you want to limit the restriction to a select number of folders, you can add these in a comma separated list.

Parameter Example Notes
folder folder="your-folder/your-subfolder" upload to a single folder
folder folder="folder1, folder 2" select which folder to upload to
folder folder="root" upload to the root folder, only permitted if allowed globally in plugin settings
comments comments=enabled optional field to allow comments on uploads. must be enabled in Settings

Related Settings

Allow Front-End File Uploads

You must enable the "Allow front-end file uploads" option in Settings in order to the upload functionality. This also requires the following 2 lines to be added to your CORS policy in S3.

Login to S3 Console, click on your bucket and then -> Permissions -> CORS Configuration, and add:

<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>

Click 'Save'.

Allowed File Types

Allowed upload file types (comma-separated) should be configured on the settings page e.g.e.g. png,PNG. If you do not specify any upload file types then none are allowed.

Users will see this error message:

"Sorry, you can't upload that kind of file. You can only add files of this type: No file types defined in settings."

Note: This setting does not affect backend file upload via wp-admin where any file type can be uploaded.

Allow Comments on File Uploads

For comments to be allowed the 'Allow comments on file uploads' settings must be enabled in the global plugins settings AND the comments=enabled parameter above must be set in the shortcode. Comments on uploads will not work without both of these set.