This hook can be used to alter the absolute path of a file when it is uploaded (i.e. change the folder that the file is saved to).
quform_upload_absolute_path_X
This hook is run for a single form.
Example
12
3
4
5
| add_filter('quform_upload_absolute_path_1', function ($path, Quform_Element_File $element, Quform_Form $form) { $path = ABSPATH . 'form-uploads/'; return $path; }, 10, 3); |
add_filter('quform_upload_absolute_path_1', function ($path, Quform_Element_File $element, Quform_Form $form) { $path = ABSPATH . 'form-uploads/'; return $path; }, 10, 3);
- On line 1, replace the number
1
with the form ID
1
2
3
4
5
6
7 | function my_quform_upload_absolute_path($path, Quform_Element_File $element, Quform_Form $form) { $path = ABSPATH . 'form-uploads/'; return $path; } add_filter('quform_upload_absolute_path_1', 'my_quform_upload_absolute_path', 10, 3); |
function my_quform_upload_absolute_path($path, Quform_Element_File $element, Quform_Form $form) { $path = ABSPATH . 'form-uploads/'; return $path; } add_filter('quform_upload_absolute_path_1', 'my_quform_upload_absolute_path', 10, 3);
- On line 7, replace the number
1
with the form ID
Parameters
$path
–string
– the current absolute path$element
–Quform_Element_File
– the File Upload element instance$form
–Quform_Form
– the form instance
quform_upload_absolute_path
This hook is run for all forms.
Example
1 2 3 4 5 | add_filter('quform_upload_absolute_path', function ($path, Quform_Element_File $element, Quform_Form $form) { $path = ABSPATH . 'form-uploads/'; return $path; }, 10, 3); |
add_filter('quform_upload_absolute_path', function ($path, Quform_Element_File $element, Quform_Form $form) { $path = ABSPATH . 'form-uploads/'; return $path; }, 10, 3);
1 2 3 4 5 6 7 | function my_quform_upload_absolute_path($path, Quform_Element_File $element, Quform_Form $form) { $path = ABSPATH . 'form-uploads/'; return $path; } add_filter('quform_upload_absolute_path', 'my_quform_upload_absolute_path', 10, 3); |
function my_quform_upload_absolute_path($path, Quform_Element_File $element, Quform_Form $form) { $path = ABSPATH . 'form-uploads/'; return $path; } add_filter('quform_upload_absolute_path', 'my_quform_upload_absolute_path', 10, 3);
Parameters
$path
–string
– the current path$element
–Quform_Element_File
– the File Upload element instance$form
–Quform_Form
– the form instance