File upload doesn't work if I have submit url .

jaioo7 27 Sep, 2012
Hi

I new to chronoform's , I have a form with prefect validations , which goes to a custom made php mailer file "submit : mailer/xxx.php", now recently I have added file upload to it , where it actually works prefect but if only the submit url is blank , how to get around this ?

Thanks in advance.
GreyHead 27 Sep, 2012
Hi jaioo7,

If you use the Submit URL then the form is submitted directly to that URL; ChronoForms never sees the submitted results and so cannot do anything with them.

If you want to do both then either you can (a) use a cURL action to send the necessary information to the mailer file; or (b) include the mailer file into ChronoForms using a PHP include() statement in a Custom Code action.

I would probably do (b) but it does depend on the way the code is set up.

Bob
jaioo7 27 Sep, 2012
Hi Bob,

Thank you for your quick reply, I would try using the second option , but where should I include My mailer file?

Chornoform : post -> name , details , email , phone , text ->(to) mymail.php -> I retrieve all the post variable and do some validations depending on "type of packager" i send different email to different package users.

If you don't mind can you please explain in detail how can I use option (b).

Thanks
jay
GreyHead 27 Sep, 2012
Hi jaioo7,

Well the simplest version would be to drag in a Custom Code action and put code like this into it:
<?php
include (JPATH_SITE.'/some_file_path/'mymail.php');
?>

You may also need some code to make the form data which is stored in the $form->data array available to the mail script.

Bob
jaioo7 28 Sep, 2012
Hi Bob,

I Am still a bit confused with this ... like
i used in form code option

<?php
include (JPATH_SITE.'/some_file_path/'mymail.php');
?>
<div class="form_item">

  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;">name</label>
    <input class="cf_inputbox" maxlength="150" size="30" title="" id="text_2" name="text_2" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_fileupload">
    <label class="cf_label" style="width: 150px;">upload your file</label>
    <input class="cf_fileinput cf_inputbox" title="trss" size="20" id="file_0" name="file_0" type="file" />
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_button">
    <input value="Submit" name="button_1" type="submit" />
  </div>
  <div class="cfclear"> </div>
</div>


my file in some location
mail.php
<?php 
session_start();
if($_SERVER['HTTP_REFERER']!=""){
	require("../lXX/PHPMailer_v5.1/class.phpmailer.php");
	$error = false;
	$mail = new PHPMailer();
	$mail->IsHTML(true); // This tell's the PhPMailer that the messages uses HTML.
	$studentName = htmlspecialchars(strip_tags(filter_input(INPUT_POST,'text_0',FILTER_SANITIZE_SPECIAL_CHARS)))
 echo $studentName;


this does'nt work .... please help me
thanks
GreyHead 28 Sep, 2012
Hi jaioo7 ,

I'm very confused. Why so you need to include a copy of the phpmailer.php file??? Joomla! already includes that and you can send emails directly from ChronoForms using the built-in email actions.

These lines seem to do something different
$studentName = htmlspecialchars(strip_tags(filter_input(INPUT_POST,'text_0',FILTER_SANITIZE_SPECIAL_CHARS)))
echo $studentName;
but there is a missing ; at the end of the first one so the PHP is broken.

If you need to sanitize the student name you can do that in ChronoForms using a Custom Code action.

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