• I’m having difficulty with the plugin.
    I would like the uploaded files to look like this:
    SITENAME_FILENAME.EXTENTION

    Where “Filename” was without spaces and without special characters.

Viewing 1 replies (of 1 total)
  • Thread Starter Welligton Sousa

    (@sousawelligton)

    add_filter( 'itsg_gf_ajaxupload_filename', 'my_itsg_gf_ajaxupload_filename', 10, 7 );
    function my_itsg_gf_ajaxupload_filename( $name, $file_path, $size, $type, $error, $index, $content_range ) {
        date_default_timezone_set('America/Fortaleza');
        $field_id = isset( $_POST['field_id'] ) ? $_POST['field_id'] : null;
        $form_id  = isset( $_POST['form_id'] ) ? $_POST['form_id'] : null;
        $file_extension = pathinfo( $name, PATHINFO_EXTENSION );
        $name = 'SITENAME' . '_' . $form_id . date("Ymd-Gis") . '-' . $field_id . '.' . $file_extension;
        return $name;
    }

    For now, I’m using this code.

Viewing 1 replies (of 1 total)
  • The topic ‘Rename files’ is closed to new replies.