quform_upload_path

This hook can be used to alter the path of a file when it is uploaded (i.e. change the folder that the file is saved to).

quform_upload_path_X

This hook is run for a single form.

Example

12
3
4
5
add_filter('quform_upload_path_1', function ($path, Quform_Element_File $element, Quform_Form $form) {    $path = 'form-uploads/'
 
    return $path;
}, 10, 3);
add_filter('quform_upload_path_1', function ($path, Quform_Element_File $element, Quform_Form $form) {
    $path = '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_path($path, Quform_Element_File $element, Quform_Form $form)
{
    $path = 'form-uploads/'
 
    return $path;
}
add_filter('quform_upload_path_1', 'my_quform_upload_path', 10, 3);
function my_quform_upload_path($path, Quform_Element_File $element, Quform_Form $form)
{
    $path = 'form-uploads/'

    return $path;
}
add_filter('quform_upload_path_1', 'my_quform_upload_path', 10, 3);
  • On line 7, replace the number 1 with the form ID

Parameters

  • $pathstring – the current path
  • $elementQuform_Element_File – the File Upload element instance
  • $formQuform_Form – the form instance

quform_upload_path

This hook is run for all forms.

Example

1
2
3
4
5
add_filter('quform_upload_path', function ($path, Quform_Element_File $element, Quform_Form $form) {
    $path = 'form-uploads/'
 
    return $path;
}, 10, 3);
add_filter('quform_upload_path', function ($path, Quform_Element_File $element, Quform_Form $form) {
    $path = 'form-uploads/'

    return $path;
}, 10, 3);
1
2
3
4
5
6
7
function my_quform_upload_path($path, Quform_Element_File $element, Quform_Form $form)
{
    $path = 'form-uploads/'
 
    return $path;
}
add_filter('quform_upload_path', 'my_quform_upload_path', 10, 3);
function my_quform_upload_path($path, Quform_Element_File $element, Quform_Form $form)
{
    $path = 'form-uploads/'

    return $path;
}
add_filter('quform_upload_path', 'my_quform_upload_path', 10, 3);

Parameters

  • $pathstring – the current path
  • $elementQuform_Element_File – the File Upload element instance
  • $formQuform_Form – the form instance

Guides using this hook

Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy