• I would like to send an attachment after form completion but file attachments doesn’t work on my install (Bedrock from roots.io)

    Tried :
    uploads/2018/02/myfile.pdf
    /uploads/2018/02/myfile.pdf
    app/uploads/2018/02/myfile.pdf
    /app/uploads/2018/02/myfile.pdf

    Everything returns : “It is not allowed to use files outside the wp-content directory.”

    Note : With Bedrock, wp-content has been renamed to app

    Is CF7 explicitly expecting “wp-content” string ?

    Is there a pitfall using a function to dynamically pick files as in the link provided ?

    Does anyone has a better solution ?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Is CF7 explicitly expecting “wp-content” string ?

    No. Contact Form 7 refers to the WP_CONTENT_DIR constant. If Bedrock has declared the constant correctly, the form uploads/2018/02/myfile.pdf should work.

    Thread Starter Alex

    (@alexgaley)

    Thank you for the precision

    Bedrock declares :

    /** @var string Directory containing all of the site’s files */
    $root_dir = dirname(__DIR__);

    /** @var string Document Root */
    $webroot_dir = $root_dir . ‘/web’;

    /**
    * Custom Content Directory
    */
    Config::define(‘CONTENT_DIR’, ‘/app’);
    Config::define(‘WP_CONTENT_DIR’, $webroot_dir . Config::get(‘CONTENT_DIR’));
    Config::define(‘WP_CONTENT_URL’, Config::get(‘WP_HOME’) . Config::get(‘CONTENT_DIR’));

    So if I understand properly app/uploads/2018/02/myfile.pdf should be the one

    This returns :

    “Attachment file does not exist at app/uploads/2018/02/myfile.pdf”

    And it is the same response for absolute path /app/uploads/2018/02/myfile.pdf

    Note : the file is present and publicly accessible at https://example.com/app/uploads/2018/02/myfile.pdf

    Thread Starter Alex

    (@alexgaley)

    A little bit more information :

    uploads directory is a symlink in Bedrock

    I could not find information about the function path_join() :
    config-validator.php l560 |?$path = path_join( WP_CONTENT_DIR, $content );

    Perhaps the function does not resolve symbolic links ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘File Attachments from renamed folder’ is closed to new replies.