This documentation page is for Quform version 1 and may not be applicable for Quform 2 click here to visit the documentation for Quform 2.
This filter hook is called when each uploaded file is processed. It can be used to modify the upload path that is set in the Form Builder at File Upload → Settings → Optional → Path to save uploaded files. The value returned from the function will be appended to the path to the WordPress uploads folder (e.g. wp-content/uploads). This hook cannot be used to set the upload path outside of the WordPress uploads folder.
iphorm_upload_path
This hook is run for all uploaded file for all forms.
Example
This code can be added to your theme functions.php file or create a plugin for it.
1 2 3 4 5 6 7 | function my_upload_path($path, $element) { // Custom code return $path; } add_filter('iphorm_upload_path', 'my_upload_path', 10, 2); |
function my_upload_path($path, $element) { // Custom code return $path; } add_filter('iphorm_upload_path', 'my_upload_path', 10, 2);
Parameters
- $path – the current path to upload the files
- $element – the iPhorm_Element_File instance that is current being processed
Note: to get the iPhorm instance you can use the code $form = $element->getForm();
Accessing form data
iphorm_upload_path_X
This filter hook is called for all uploaded files in a single form, replace X with the form ID.
Example
This code can be added to your theme functions.php file or create a plugin for it.
1 2 3 4 5 6 7 | function my_upload_path($path, $element) { // Custom code return $path; } add_filter('iphorm_upload_path_1', 'my_upload_path', 10, 2); |
function my_upload_path($path, $element) { // Custom code return $path; } add_filter('iphorm_upload_path_1', 'my_upload_path', 10, 2);
Parameters
- $path – the current path to upload the files
- $element – the iPhorm_Element_File instance that is current being processed
Note: to get the iPhorm instance you can use the code $form = $element->getForm();