Hi Everyone,
I am trying to create a form where the e-mail generated has a file attached. GrayHead had answered the question and posted the following code:
I can't get it to work. Here's what I'm doing
- Replacing $MyForm with $Campaign01 which is my form's name
- Replacing ->id; with ->2; which is my form's ID
- Replacing 'files/vendorlist.pdf' with 'document/filename.pdf' (not real file name)which is where I placed the file I want to send as attachment (after creating the document folder in the rood directory)
- Dropping the code in the Form Code tab under On Submit code - before sending email:
The form submits OK, but it doesn't contain the attachment. I've also tried a full URL for the file location: 'http://www.mydomain.com/document/filename.pdf' but it doesn't work still.
What am I going wrong?
Jose
EDIT: BTW, I'm on CF V3.1_RC5.5
I am trying to create a form where the e-mail generated has a file attached. GrayHead had answered the question and posted the following code:
<?php
$form_id = $MyForm->formrow->id;
$MyUploads =& CFUploads::getInstance($form_id);
$MyUploads->attachments[] = 'files/vendorlist.pdf';
?>
I can't get it to work. Here's what I'm doing
- Replacing $MyForm with $Campaign01 which is my form's name
- Replacing ->id; with ->2; which is my form's ID
- Replacing 'files/vendorlist.pdf' with 'document/filename.pdf' (not real file name)which is where I placed the file I want to send as attachment (after creating the document folder in the rood directory)
- Dropping the code in the Form Code tab under On Submit code - before sending email:
The form submits OK, but it doesn't contain the attachment. I've also tried a full URL for the file location: 'http://www.mydomain.com/document/filename.pdf' but it doesn't work still.
What am I going wrong?
Jose
EDIT: BTW, I'm on CF V3.1_RC5.5
Hi baxterdown,
Leave these two unchanged - my code is correct as it is (I hope):
- Replacing $MyForm with $Campaign01 which is my form's name
- Replacing ->id; with ->2; which is my form's ID
Bob
Leave these two unchanged - my code is correct as it is (I hope):
- Replacing $MyForm with $Campaign01 which is my form's name
- Replacing ->id; with ->2; which is my form's ID
Bob
Hi Bob,
Thanks for the quick reply. I changed the two lines back to your code and it didn't work. I tried both absolute and relative path URLs to the file. Also, I checked to make sure the path to the file is correct...
Would you like temporary login?
The form is located here
Thanks!
Jose
Thanks for the quick reply. I changed the two lines back to your code and it didn't work. I tried both absolute and relative path URLs to the file. Also, I checked to make sure the path to the file is correct...
Would you like temporary login?
The form is located here
Thanks!
Jose
Hi Jose,
Sure, PM or email me a SuperAdmin login and I'll take a quick look.
Bob
Sure, PM or email me a SuperAdmin login and I'll take a quick look.
Bob
Thanks! I just PMd you.
j.
j.
Hi Jose,
There a system message saying "LOADING FAILED::Uploads Class" which means that the CFUPloads class isn't being loaded correctly. I'm not sure why that should be - I will take a longer look in the morning.
Bob
There a system message saying "LOADING FAILED::Uploads Class" which means that the CFUPloads class isn't being loaded correctly. I'm not sure why that should be - I will take a longer look in the morning.
Bob
Hi Bob, I know... it's late over there!🙂 Thanks for looking. If it's of any help, I was getting the same error until I replaced ->id; with ->2. I stopped getting the error afterward.
G'nite.
Jose
P.S. I get up early. So I should be able to answer any comments you might have around lunch time your time.
G'nite.
Jose
P.S. I get up early. So I should be able to answer any comments you might have around lunch time your time.
This topic is locked and no more replies can be posted.