File Upload Field – Wc Fields Factory

Product Field

Insert a file input field on the product page.

Option Description
Allowed File Types Types of files that user allowed to upload through this field, enter valid file extensions, mime types with delimited by comma. These values will be used to filter the File Browser dialog box as well as for the server side validation.
Multiple Files Upload Whether to support multiple files to upload at the same time on this field.
Preview Option Works only on image file types, if this option is enabled then Image Preview will be displayed at the Cart & Check out page.
note: Only the file’s absolute path will be inserted as the Order Item Meta.
Upload Path By default all files will be upload on WordPress’s wp-uploads location. using this option you can point to different folders (But within the wp-content).
Required Make this file field mandatory – user cannot perform Add To Cart operation without upload this file.
Message Message that has to be displayed when validation failed for this field (When the Required Option is Set).
Visibility Whether this color picker field’s value (Chosen by the user) has to be displayed on the Cart & Check Page
Note: Regardless of this option this fields value will be added as Order Meta (Unless you configured not so).
Order Item Meta Whether to add this field’s value (Chosen by the user) as Order Item Meta.
Logged in Users Only Make this field available only for the Registered Users only (They must have to be logged in)
Target Roles Make this field available only for the users that have the selected roles. Available to all, if you haven’t selected any
Editable Make this field’s value editable on Cart Page – (incase If user has gave a wrong value, he can correct it on the cart page itself, no need to go back to product page).
Note: this is only for the Cart page not for the Checkout Page.
Cloneable Field level cloning option – Whether this field is cloneable or not (Works only if Cloning option is enabled from the Settings Page).
Field Class Use this option to add a custom css class to this field for your own styling purpose (not much use though, since file fields rendering is done by the browser itself)

Note : Allowed file types config, you can provide multiple allowed file type extensions (separated by comma), extension should be prefixed with “.” (.jpg, .png, .pdf). You can also provide allowed mime types like, image/* (which allows all images file types), audio/* (which allows all audio file types). You can also provide multiple mime types separated by comma.

WC Fields Factory uses PHP’s Fileinfo module to determine the Uploaded mime types. PHP 5.3.0 and later have Fileinfo built in, but on Windows you must enable it manually in your php.ini.

Product Field Raw Output
<table class="wccpf_fields_table ">
			<!-- Label section starts here -->
			<td class="wccpf_label">
				<label for="test_file_field">Test File Field</label>
			<!-- Label section ends here -->
			<td class="wccpf_value">
				<!-- Actual field starts here -->
				<input type="file" class="wccpf-field " name="test_file_field" wccpf-type="file" wccpf-pattern="mandatory" wccpf-mandatory="no" data-cloneable="yes">
				<!-- Actual field ends here -->
				<!-- Validation message section -->
				<span class="wccpf-validation-message"></span>

Admin Field

File upload field not available for Admin Fields.

Leave a Reply

Your email address will not be published. Required fields are marked *