You can alter the path of the file uploads to contain a submitted form value. It’s only possible alter the part of the path after the WordPress uploads directory.
Note: this will apply to all File Upload fields in the form.
Add the following code to your site (see Adding custom code for help). The example below will upload the file to folder wp-content/uploads/form-uploads/VALUE/ where VALUE is the submitted value.
123 4 56 | add_filter('quform_upload_path_1', function ($path, Quform_Element_File $element, Quform_Form $form) { $value = $form->getValueText('quform_1_3'); $value = sanitize_file_name($value); return "form-uploads/$value/";}, 10, 3); |
add_filter('quform_upload_path_1', function ($path, Quform_Element_File $element, Quform_Form $form) {
$value = $form->getValueText('quform_1_3');
$value = sanitize_file_name($value);
return "form-uploads/$value/";
}, 10, 3);1 2 34 5 67 8 | function my_override_upload_path($path, Quform_Element_File $element, Quform_Form $form { $value = $form->getValueText('quform_1_3'); $value = sanitize_file_name($value); return "form-uploads/$value/";} add_filter('quform_upload_path_1', 'my_override_upload_path', 10, 3); |
function my_override_upload_path($path, Quform_Element_File $element, Quform_Form $form
{
$value = $form->getValueText('quform_1_3');
$value = sanitize_file_name($value);
return "form-uploads/$value/";
}
add_filter('quform_upload_path_1', 'my_override_upload_path', 10, 3);