Skip to main content

How to remove hash in front of uploaded files?

I want to use the file upload field in FF Pro, but just learned that when a file is uploaded, the filename is prefixed with a unique hash. For example, if I upload "mysamplefile.pdf", the uploaded file is saved with a name like "ff-552213c9a6286de084cafc9e952e211c-ff-mysamplefile.pdf".

I understand why the uploaded files are prefixed with the hash code, but I would like to have the uploaded file name to not have it prefixed. How do I stop the prefixing?

Dhrupo Nil

You can modify the uploaded file name with this hook

https://developers.fluentforms.com/hooks/filters/#file-uploader-filters

add_filter('fluentform/uploaded_file_name', function ($file, $originalFileArray, $formData, $form) {
    // Do your stuff here
    $file['name'] = 'custom_file_name';
    return $file;
}, 10, 4);