Hi, I'm trying to use this Custom Code
<?php
$path = JPATH_SITE.'/components/com_chronoforms5/uploads/folder_name/';
$form->files['field_name']['path'] = $path.'file_name.jpg';
?>
but it does not seem to work with Chronoforms v6.
The problem is that the email does not start,
in fact the debugger gives me this view: files] => Array
(
[0] => guide
)
[result] => the Mail could not be sent.
Thanks to everyone who wants to help me
<?php
$path = JPATH_SITE.'/components/com_chronoforms5/uploads/folder_name/';
$form->files['field_name']['path'] = $path.'file_name.jpg';
?>
but it does not seem to work with Chronoforms v6.
The problem is that the email does not start,
in fact the debugger gives me this view: files] => Array
(
[0] => guide
)
[result] => the Mail could not be sent.
Thanks to everyone who wants to help me
Hi gmarra,
If this is the same file each time you can add the full file path to the Attachments list box in the Email action.
Bob
If this is the same file each time you can add the full file path to the Attachments list box in the Email action.
Bob
Hello
This is an old thread but my issue is the same. I have a dropdown choice list that the visitor can chose from as to what he needs to download. As per the choice an email goes to the visitor with the chosen file as an attachment.
I used this code in CFV5 successfully:
I used a custom code block with this code and named it as "attach_file" and in the attachment list of the email I added {var:attach_file} but I do not get it to work.. The email is sent successfully but without any attachment.
Please suggest where am I going wrong.
Thanks
Ron
This is an old thread but my issue is the same. I have a dropdown choice list that the visitor can chose from as to what he needs to download. As per the choice an email goes to the visitor with the chosen file as an attachment.
I used this code in CFV5 successfully:
<?phpI cannot seem to succeed in doing it in CFV6.
switch ($_POST['select1'])
{
case 'File 1':
$form->files['catalog'] = array(
'path' => '/home/xyz/public_html/cat/file1.pdf'
);
break;
case 'File 2':
$form->files['catalog'] = array(
'path' => '/home/xyz/public_html/cat/file2.pdf'
);
break;
}
?>
I used a custom code block with this code and named it as "attach_file" and in the attachment list of the email I added {var:attach_file} but I do not get it to work.. The email is sent successfully but without any attachment.
Please suggest where am I going wrong.
Thanks
Ron
switch($this->data("field_name"))and
$this->set("var_name", "value")and use {var:var_name} in the email attach files field. Or just return the file path string, and use {var:phpname}
Or use a switch action, data source {data:fieldname}, returning the path (shouldn't need to be an array unless you're needing to upload multiple files)
Hello healyhatman,
Thanks for the help. You mean my code should be like this :
Well it does not work and the submission hangs on submit. The debugger does not show anything. Maybe I am making a mistake somewhere.
Ron
Thanks for the help. You mean my code should be like this :
<?php
switch($this->data("select1"))
{
case 'File 1':
$this->set('attach_file', 'value') = array(
'path' => '/home/xyz/public_html/cat/file1.pdf'
);
break;
case 'File 2':
$this->set('attach_file', 'value') = array(
'path' => '/home/xyz/public_html/cat/file2.pdf'
);
break;
}
?>
Well it does not work and the submission hangs on submit. The debugger does not show anything. Maybe I am making a mistake somewhere.
Ron
No, where it says"value" you should put the value. And you should use the dropdown value not label in the switch cases
Okay. So you mean this way ?
<?php
switch ( $this->data( "File 1" ) ) {
case 'File 1':
$this->set( 'attach_file', 'File 1' ) = array(
'path' => '/home/xyz/public_html/cat/file1.pdf'
);
break;
}
switch ( $this->data( "File 2" ) ) {
case 'File 2':
$this->set( 'attach_file', 'File 2' ) = array(
'path' => '/home/xyz/public_html/cat/file2.pdf'
);
break;
}
?>
No. Put the value you are setting. No =
$this->set("var_name", "the actual value you want var_name to be");
But really just use a switch action (not event switcher). What you're doing doesn't need to be done in PHP.
But really just use a switch action (not event switcher). What you're doing doesn't need to be done in PHP.
I know switcher could be easy. But I don't know haw to put the values there. I tried reading the manual but could not het it to work.
Thanks
Ron
Really?
Data source should be {data:dropdownfieldname}
Then you have
By the way your switch syntax is all over the place.
Data source should be {data:dropdownfieldname}
Then you have
optionvalue:texttoreturnSo you would for example have
file1:path/to/the/file.pdf
By the way your switch syntax is all over the place.
WOW.. Thanks.
This is what was confusing me. I am going to try now.
Thanks again..
Ron
This is what was confusing me. I am going to try now.
Thanks again..
Ron
Hello healyhatman,
The debugger gives this output but no email is being sent :

Thanks for all the help
Ron
The debugger gives this output but no email is being sent :

Thanks for all the help
Ron
And what have you put in the attach files box in the email action
I have a custom code for my email body. named "for_email" and in email body I call it by {var:for_email} The switch is named "attach_file" and in Attachments list I added {var:attach_file}
And you have the switch set to return var only?
Does the file actually exist at the location specified
What error does the debug show
What error does the debug show
Yes the file exists. CFV5 works at this moment. The debugger shows no error.. I sent a screen shot in earlier post,
Thanks
Thanks
The debugger you sent shows nothing, send the whole thing. Copy paste.
Hello,
The switch block may not work as it takes the path as an email. So the email sending fails and no attachment is establishes. I tried with custom code and also with php block. Nothing seems to work.
Any help I would greatly appreciate.
Thanks
Ron
The switch block may not work as it takes the path as an email. So the email sending fails and no attachment is establishes. I tried with custom code and also with php block. Nothing seems to work.
Any help I would greatly appreciate.
Thanks
Ron
I replied to your PM. Check your file location. What do you mean it "takes the path as an email"?
Try just putting the path to one file directly in the file attach list and see if it sends
Try just putting the path to one file directly in the file attach list and see if it sends
Try just putting the path to one file directly in the file attach list and see if it sends
Okay . I am going to do this.
Thanks for all the help.
Ron
Hello,
Could not succeed in attaching any file. If I add anything in the attach Attachments settings it stops sending email.
I don't know what more to do.
Could not succeed in attaching any file. If I add anything in the attach Attachments settings it stops sending email.
I don't know what more to do.
Send me login details and I'll have a look
This topic is locked and no more replies can be posted.
