Skip to content

Instantly share code, notes, and snippets.

@iamrealfarhanbd
Created June 15, 2022 06:56
Show Gist options
  • Save iamrealfarhanbd/6ac12cbfd7de1a31a9d1e518789ef645 to your computer and use it in GitHub Desktop.
Save iamrealfarhanbd/6ac12cbfd7de1a31a9d1e518789ef645 to your computer and use it in GitHub Desktop.
add_filter('fluent_file_uploaded', function($uploadFile, $formData, $form) {
$url = $uploadFile['url'];
$uploadDir = str_replace('/', '\/', FLUENTFORM_UPLOAD_DIR.'/temp' );
$pattern = "/(?<=${uploadDir}\/).*$/";
preg_match($pattern, $url, $match);
if (!empty($match)) {
$file = str_replace($match[0], \FluentForm\App\Helpers\Protector::decrypt($match[0]), $url);
}
return $file ;
},10,3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment