Skip to content
Snippets Groups Projects
Commit 84563a88 authored by Lucas García's avatar Lucas García
Browse files

feat: custom uplaod directory

parent c64e1b95
No related branches found
No related tags found
No related merge requests found
......@@ -112,3 +112,21 @@ function wpct_crm_forms_prepare_submission($form_vals)
}
add_filter('wpct_crm_forms_prepare_submission', 'wpct_crm_forms_prepare_submission', 10, 2);
/**
* Store uploads on a protected folder
*/
add_filter('gform_upload_path', 'wpct_forms_sm_upload_path', 90);
function wpct_forms_sm_upload_path()
{
$upload_dir = wp_upload_dir();
$path = $upload_dir['basedir'] . '/protected';
if (!is_dir($path)) mkdir($path);
$path .= '/' . date('Y');
if (!is_dir($path)) mkdir($path);
$path .= '/' . date('m');
if (!is_dir($path)) mkdir($path);
return $path;
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment