• Hello,
    I had this error:

    [03-Jan-2022 14:59:21 UTC] PHP Notice: Failed to attach a file. /var/www/FALCONIA/amarulasolutions_com_www/wp-content/uploads/wpcf7_uploads/1626959564/E42-Guida-alla-configurazione-della-casella-email.pdf is not in the allowed directory. in /var/www/FALCONIA/amarulasolutions_com_www/wp-content/plugins/contact-form-7/includes/mail.php on line 147

    And solved by forcing to false the check of !wpcf7_is_file_path_in_content_dir( $path ). What could be wrong? This is a very standard WP installation (mono-site, no custom upload folders, standard permissions etc). I could debug further, but I’m sure you can do it much better!

    Thank you and kind regards

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

    (@takayukister)

    Where can we see the website in question?

    Thread Starter ELAN42///

    (@nokao)

    I could give you FTP access, if you have some secure way of sharing the credentials.

    Or I can just report the details you need. Please tell me.

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    Thread Starter ELAN42///

    (@nokao)

    Since I cannot share publicly the website URL, I’ll look for another solution.

    Anyway:

    – Since I have been using CF7 on hundreds of website, I would like to understand too: if looking at a front-end page can help you debug the issue, could you please tell me what kind of checks can you do from a browser?

    – I consider the error reported as a bug, indipendent from the single website: there is no kind of admin notice telling the website administrator or the compiling user that a file was attached and not received, and it could be discovered only by looking at PHP logs.

    Thank you anyway and best regards

    I have the same problem, and thanks to @nokao I looked at the wpcf7_is_file_path_in_content_dir( $path ) function, and found that the reason that this check returns false is because our uploads folder is a symbolic link, and since that function compares $path with realpath( $path ), the result is false and that triggers the error and prevents the attachment of the file.

    What can we do to solve this? Our uploads folder must stay a symbolic link since it helps performance.

    • This reply was modified 3 years, 1 month ago by Lea.
    Thread Starter ELAN42///

    (@nokao)

    That seems exactly our case, too: unmanaged symbolic links.

    Mr Takayuki, could it be fixed in the next upgrades?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘File attachment bug’ is closed to new replies.