File Upload

RSform!Pro upload field

Standard HTML input upload field with the following configuration tabs:

General

  • Name: the name of the form component. This needs to be unique for each form. It can contain only alphanumeric chars. The name of the field is only used for internal reference - it will not be displayed in the front-end area.
  • Caption: the caption or label is the text or HTML that is being displayed in the actual form.
  • Description: text/HTML area that provides a description of the field. This can be useful for providing explanations or indications for that particular field.

Validations

  • As a validation rule, this can only be set to be Required or not.
  • Validation Message: text / HTML area that will allow you to set up a message that will be displayed if the field validation fails.

The File Upload field will display specific validation rules for the following cases:

  • Minimum amount of files required
  • Maximum amount of files required
  • File size limit exceeded
  • Invalid extension

Attributes

The Attributes area allows you to select Multiple Files, add JavaScripts triggers, custom style (for that particular field), impose size restrictions, etc. Anything filled in this area, will be added directly to the HTML tag.

  • Multiple: Yes / No. Set this to Yes if you want to allow users to upload multiple files at once.
  • 'Add More Files' Button: Yes / No. Set this to Yes if you want to add more files by clicking on a button. You can translate the 'Add another file' text of this button by creating a language override for the COM_RSFORM_FILE_ADD_PLUS constant.
  • Minimum Uploads: Set the minimum ammount of files to be uploaded.
  • Maximum Uploads: Set the maximum ammount of files to be uploaded, leave 0 for unlimited number of files.
  • Separator: choose a separator to use when displaying multiple values. By default, this is set to <br />
  • File size: the maximum size of an accepted file. This should be specified in KB.
  • Accepted Extensions: in this field you can configure the accepted file extensions. Simply specify an extension and press enter to specify another, eg. jpg png
  • Allow Only Images: Yes / No. If you want to accept only images to be uploaded, set this option to Yes. The most common image file extensions will be accepted: jpeg, jpg, png, gif and webp. Images can also be resized by adding values in the Thumb fields available when enabled.
  • Show Image Preview: Yes / No. Set this to Yes if you would like to automatically load the image and display it below the input.
  • Thumb Width (Pixels): Specify the thumb width, in pixels.
  • Thumb Quality (Percent): Specify the quality of resulting JPEG thumbnail.
  • Thumb Extension: Select the extension of the resulting thumbnail (jpg or png).
  • Destination: the path to the upload folder.
  • File prefix: to prevent file replacements in the upload folder, RSForm!Pro adds a random prefix to the uploaded file names. If you specify a prefix - this will be added instead. You can also use a PHP code to generate the prefix dynamically. This should be specified in between the //<code> and //</code>, example:
    //<code>
    return $_POST['form']['name_field'];
    //</code>
  • Sanitize Filename: the file can be lowercased, transilterated and stripped of characters that are not in the alphanumeric range.
  • Attach file to: the file can be attached to the User, Admin emails and as well as to the configured Additional Emails.
  • File size: the maximum size of an accepted file. This should be specified in KB.
  • Additional Attributes: anything filled in this area, will be added directly to the HTML input tag. For example:
    JavaScript: onchange="your_function();" - this will trigger a JavaScript function when you upload a file.
    CSS: style="margin-left:20px" - this will set a 20px margin on the left side.

The File Upload allows you to drag and drop files to be uploaded on the actual file upload element.


File Upload placeholders:

Regular placeholders
Placeholder name Description
{your_field_name:value} returns a direct download link of the file.
{your_field_name:caption} returns the configured field caption.
Specific placeholders
Placeholder name Description
{your_field_name:path} This will return the direct access URL for the file. Useful to show the uploaded image within the Thank You Message page for example (eg. http://www.your-website.com/path/to/uploaded/image.png).
{your_field_name:localpath} This will be replaced with the local path of the file found on the server(eg. /home/public_html/path/to/uploaded/image.jpg). This can also be used with the PDF Plugin, you can add the value of your file Upload Fields in the PDF attachment.
{your_field_name:filename} You can use this placeholder in order to return the name of the uploaded file exactly as it is saved in the database.
{your_field_name:image} You can use this placeholder in order to generate image tags: <img>.
{your_field_name:localimage} Similar to the above 'localpath' placeholder, this one is used for PDF files and the local path of the file found on the server will be retrieved.
{your_field_name:count} You can use this placeholder in order to return the number of uploaded files.
Multiple File upload placeholders

{your_field_name_index:value} - for File Upload fields with the 'Multiple' option set to 'Yes', you can now use individual placeholders to identify and return the file with the corresponding index. Assuming that you have maximum 3 file uploads set, you can use (it always starts with 0):

Placeholder name Description
{your_field_name_0:value} returns the first file download link.
{your_field_name_1:value} returns the second file download link.
{your_field_name_2:value} returns the third file download link.
 

62 persons found this article helpful.


Was this article helpful?

Yes No
Sorry about that