file upload did not get attach to email

nilubon03 20 Feb, 2015
Hello,

I was able to send email out with attachment when I have a test site last year. Early this year, I just make it live to another server. Then, I have learned that there is no file upload attached to email on the live site. However, upload file to the server is fine.

Please advise what to look for to solve this issue.

Thank you,
Nilubon
GreyHead 20 Feb, 2015
Hi nilubon03,

I can't see anything wrong there but most of the information isn't visible.

Please take a Form Backup using the icon in the Forms Manager and post it here (as a zipped file) or PM or email it to me and I'll take a closer look.

Bob
nilubon03 20 Feb, 2015
Hi Bob,

Thank you so much for your quick respond. Please see attached. I am assuming it may relate to the permission because I did not change anything on my code and my form. However, if it relate to the permission, why can people upload the files to the server?

Best,
Nilubon
GreyHead 21 Feb, 2015
Answer
1 Likes
Hi Nilubon,

I think that the problem is that this code in the Event Switcher wont' work
<?php
    if ($form->data['Attachment'] == '') {
        return 'noUpload';
    }
    else {
        return 'withUpload';
    }
?>
It is checking for a value in $form->data['Attachment'] . . . but that is set by the Upload Files action which hasn't run at that point in the process so it will always return 'noUpload'.

You don't need the Event Switcher at all. If you put the Upload Files action before an Email action - if there is an upload it will be attached, if there isn’t then it won't be attached.

Bob
nilubon03 23 Feb, 2015
Hi Bob,

I think too much.🙂

It worked when I have upload action and email action without Event Switcher.

Thank you for your time.

Nilubon
This topic is locked and no more replies can be posted.