Skip to content

File Upload atatched to Email, instead of link #116

@MontroseSt

Description

@MontroseSt

Hi, great plugin! I was wondering if the files uploaded on the front end can be attached to the email (instead of a email link)?

Also it would be great to add the option to define a custom upload folder for all form attachments. I used the following code:

// change acf file name "file" to required name
add_filter( 'acf/upload_prefilter/name=file', 'secure_upload_prefilter' );
add_filter( 'acf/prepare_field/name=file', 'secure_files_field_display' );

function secure_upload_prefilter( $errors ) {

add_filter( 'upload_dir', 'secure_upload_directory' );

return $errors;

}

function secure_upload_directory( $param ) {

//upload folder
$folder = '/wp-content/uploads/_acf-forms';

$param['path'] = WP_CONTENT_DIR . $folder;
$param['url'] = WP_CONTENT_URL . $folder;
$param['subdir'] = $folder;
$param['basedir'] = WP_CONTENT_DIR;
$param['baseurl'] = site_url();

return $param;

}

function secure_files_field_display( $field ) {

// update paths accordingly before displaying link to file
add_filter( 'upload_dir', 'secure_upload_directory' );

return $field;

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions