• Resolved oanishchik

    (@oanishchik)


    As I understand, your plugin does not support validation for Drag and Drop Multiple File Upload — Contact Form 7, i.e. I can’t make a group to show (or not to) depending on the presence (or absence) of files attached via that plugin (it uses a distinctive ‘mfile’ tag). Is it a chance to make it work? Probably by adding some function to fuctions.php? If it’s not possible, is there a chance for the support of that plugin to be added to yours later?
    Best,

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jules Colle

    (@jules-colle)

    No, the plugins aren’t compatible. But did you know that you can also drag files to a regular files upload? It will work without any additional plugins installed.

    You can style the file field with some CSS so it looks like an actual drop area. Check https://css-tricks.com/drag-and-drop-file-uploading/.

    If you want to upload multiple files, you will need the multifile control, which is available in conditional fields PRO: https://conditional-fields-cf7.bdwm.be/multifile/

    Thread Starter oanishchik

    (@oanishchik)

    Yes, I do know. The specific of the plugin I mentioned is that – unlike CF7 and yours – it allows not to attach uploaded files to an email, but just provide a recipient (site admin) with a link for downloading them, that resolves many potential issues with emails burdened, sometimes, by many different heavy files with large names and at the same time gives an ability to receive much more than a couple of dosens MB of files, email services capable to work with (and I’m especially interested in this possibility). So, if there is a chance to resolve the issue, that would be great!

    Plugin Author Jules Colle

    (@jules-colle)

    How so? I thought you can simply include the file field name in your email message and it will output the link for you to download, no?

    Thread Starter oanishchik

    (@oanishchik)

    I can’t confirm that this is the way of working either CF7 or your plugin. When I add a file-field name (smth like [file-000] for CF7 or [multifile-000] for your plugin) to the email body, I just get a name of the file only, not a link to download it. Moreover, if I check an upload directory of my site, I would not find any files uploaded by the site visitor. As I understand, with these plugins that is exactly what should be expected. That’s what we see on the CF7 official site: ‘Contact Form 7 moves the uploaded file to a temporary folder. At this point, Contact Form 7 attaches the file to the mail and sends it. After these procedures, Contact Form 7 then removes the file from the temporary folder.’

    Plugin Author Jules Colle

    (@jules-colle)

    You’re right, seems like the files are indeed deleted by default.

    I think you could circumvent this by hooking into the 'wpcf7_before_send_mail' filter, and move the uploaded files to your own super secret folder. It’s crucial that you keep this secret because otherwise all files your users upload will be up for grabs.

    Something like this should work (untested):

    add_action('wpcf7_before_send_mail', function($form, $abort, $submission) {
      if(isset($_FILES) && count($_FILES)) {
        foreach($_FILES as $file) { 
          move_uploaded_file($file['tmp_name'], '/super-secret-path/'.$file['name']);
        }
      }
    }, 10, 3);

    You might want to add some extra checks and sanitisation.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Third-partes’ plugins support’ is closed to new replies.