Menu

Upload form no email notification

Help
2008-04-12
2013-06-03
  • Scott Johnson

    Scott Johnson - 2008-04-12

    Just installed a simple form that asks for name, email and select a file to upload.  Uploads file alright but I do not receive an email notification about the upload.  What did I miss??

    Scott

     
    • TNTEverett

      TNTEverett - 2008-04-13

      It's hard to tell just from your post.  I would know better if I could see the forma and the processor.php file. 
      What version of the generator are you using?
      Have you checked with your host to see if the php mail function should work?
      In version 2.09 sometimes this line causes problems:
      $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));

      but since you are uploading files it might be in use.  You can try removing it but be prepared to put it back if teh file upload no longer works. 

       
    • Scott Johnson

      Scott Johnson - 2008-04-14

      I have no idea which version of the generator I am using the generator from the following link: http://phpformgen.sourceforge.net/new_demo/phpformgen/

      The form is sitting at: http://cheapfullcolorprinting.net/form25331/form.html

      <?php

      $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

      session_start();
      if( ($_SESSION['security_code']==$_POST['security_code']) && (!empty($_POST['security_code'])) ) {
      // File upload handling
      if($_FILES['field_3']['name']!=''){
      $field_3_filename = "file_3_".date("sihdmY").substr($_FILES['field_3']['name'],strlen($_FILES['field_3']['name'])-4);
      if(!move_uploaded_file($_FILES['field_3']['tmp_name'], "./files/".$field_3_filename)){
      die("File " .  $_FILES['field_3']['name'] . " was not uploaded.");
      }
      }

      // File upload handling
      if($_FILES['field_4']['name']!=''){
      $field_4_filename = "file_4_".date("sihdmY").substr($_FILES['field_4']['name'],strlen($_FILES['field_4']['name'])-4);
      if(!move_uploaded_file($_FILES['field_4']['tmp_name'], "./files/".$field_4_filename)){
      die("File " .  $_FILES['field_4']['name'] . " was not uploaded.");
      }
      }

      $fileLine = "Name: " . $_POST['field_1'] . "
      Your Email: " . $_POST['field_2'] . "
      Upload Image 1: " . $_POST['field_3'] . "
      Upload Image 2: " . $_POST['field_4'] . "

      ";
      $filename = '';
      if (is_writable($filename)) {

                      if (!$handle = fopen($filename, 'a'))
                      {
                           echo "Cannot open file ($filename)";
                           exit;
                      }
                      if (fwrite($handle, $fileLine) === FALSE) {
                          echo "Cannot write to file ($filename)";
                          exit;
                      }

                      fclose($handle);

                  } else {
                      echo "The file  is not writable";
                  }

      include("confirm.html");
      }
      else {
      echo "Invalid Captcha String.";
      }

      ?>

       
      • TNTEverett

        TNTEverett - 2008-04-14

        There is no mail function.  You should go back to the generator and make sure you select the email notification option under delivery method. 

        Use this link to get back to edit your form. 
        http://phpformgen.sourceforge.net/new_demo/phpformgen/page_home.php?form_id=25331

         
    • Scott Johnson

      Scott Johnson - 2008-04-14

      Am I able to still have the file uploaded to the sever AND an email notification go out to me?

      I notice that I am only able to select one of three choices...

      Database
      Email
      File

      Thanks for the assistance

      Scott

       
      • TNTEverett

        TNTEverett - 2008-04-14

        When you are editing your form page and you select a file upload field, this is completely separate from the notification method. 

         
      • Susan

        Susan - 2008-04-14

        Yes, you can have both an email and a file for the same form. You just need to enter the email address and click update, then choose file and enter the filename (e.g., formdata.txt) and click update again. Same for the database option.

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.