Page 2 of 6 FirstFirst 1234 ... LastLast
Results 11 to 20 of 57
  1. #11
    Join Date
    Nov 2010
    Posts
    101
    Plugin Contributions
    0

    Default Re: Adding Multiple Images to Custom form To be sent to Admin Email

    ok I found this code that will process that data with the $_FILES array, but not sure if this is correct or if I need to add any more information.

    PHP Code:
    // Where the file is going to be placed 
    $target_path "uploads/";

    /* Add the original filename to our target path.  
    Result is "uploads/filename.extension" */
    $target_path $target_path basename$_FILES['uploadedfile']['name']); 

  2. #12
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: Adding Multiple Images to Custom form To be sent to Admin Email

    1. To do uploads, you need to change the form attributes:
    Code:
    <?php echo zen_draw_form('vehicle_tradein', zen_href_link(FILENAME_VEHICLE_TRADEIN, 'action=send')); ?>
    must change to:
    Code:
    <?php echo zen_draw_form('vehicle_tradein', zen_href_link(FILENAME_VEHICLE_TRADEIN, 'action=send'), 'POST', 'enctype="multipart/form-data"'); ?>
    2. Adding this in place of your $att_array lines might do the job:
    Code:
    $att_array = array();
    include(DIR_WS_CLASSES . 'upload.php');
    foreach($_FILES as $key => $file) {
      if (zen_not_null($_FILES[$key]['tmp_name'])) {
        if ($upload = new upload($key, DIR_FS_UPLOADS)) {
            $att_array[] = array('file' => $upload->destination . $upload->filename, 'name' => $upload->filename);
        }
      }
    }
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #13
    Join Date
    Nov 2010
    Posts
    101
    Plugin Contributions
    0

    Default Re: Adding Multiple Images to Custom form To be sent to Admin Email

    ok when I added these lines i'm getting a red rectangle on the form success page that says warning no file uploaded.
    Last edited by GodfatherAntiques; 18 Jan 2013 at 02:17 AM.

  4. #14
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: Adding Multiple Images to Custom form To be sent to Admin Email

    Then you'll need to do some debugging to find out what's failing where and why.
    It could be permissions problems.
    It could be form problems.
    It could be a logic error.
    etc.

    I don't have this code installed on any sites. I spent an hour to research existing Zen Cart code and wrote my post based on things already working in regular Zen Cart.
    My code could be wrong.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #15
    Join Date
    Nov 2010
    Posts
    101
    Plugin Contributions
    0

    Default Re: Adding Multiple Images to Custom form To be sent to Admin Email

    I'm not getting any debug errors in the cache folder, and I have the images/uploads/ set to 777. So not really not sure what might be causing this problem.
    Last edited by GodfatherAntiques; 18 Jan 2013 at 02:28 AM.

  6. #16
    Join Date
    Nov 2010
    Posts
    101
    Plugin Contributions
    0

    Default Re: Adding Multiple Images to Custom form To be sent to Admin Email

    Thank you drbyte for your help....I finally got it working. With your help and the help of reasearch I was able to figure it out. I really appreciate the contribution you provide the Zen Cart community. I will post updated information later about how I got it working....so other's can benefit from this forum.

  7. #17
    Join Date
    Mar 2011
    Location
    Pensacola, FL
    Posts
    88
    Plugin Contributions
    4

    Default Re: Adding Multiple Images to Custom form To be sent to Admin Email

    Quote Originally Posted by GodfatherAntiques View Post
    Thank you drbyte for your help....I finally got it working. With your help and the help of reasearch I was able to figure it out. I really appreciate the contribution you provide the Zen Cart community. I will post updated information later about how I got it working....so other's can benefit from this forum.
    Here's one zenner who would definitely appreciate your updates, GF. I'm hoping to do the same thing. - mike

  8. #18
    Join Date
    Nov 2010
    Posts
    101
    Plugin Contributions
    0

    Default Re: Adding Multiple Images to Custom form To be sent to Admin Email

    1st you have to create /includes/extra_datafiles/your_custom_file_name.php

    HTML Code:
    <?php
    //
    // +----------------------------------------------------------------------+
    // |zen-cart Open Source E-commerce                                       |
    // +----------------------------------------------------------------------+
    // | Copyright (c) 2003 The zen-cart developers                           |
    // |                                                                      |
    // | http://www.zen-cart.com/index.php                                    |
    // |                                                                      |
    // | Portions Copyright (c) 2003 osCommerce                               |
    // +----------------------------------------------------------------------+
    // | This source file is subject to version 2.0 of the GPL license,       |
    // | that is bundled with this package in the file LICENSE, and is        |
    // | available through the world-wide-web at the following url:           |
    // | http://www.zen-cart.com/license/2_0.txt.                             |
    // | If you did not receive a copy of the zen-cart license and are unable |
    // | to obtain it through the world-wide-web, please send a note to       |
    // | [email protected] so we can mail you a copy immediately.          |
    // +----------------------------------------------------------------------+
    
    
      define('FILENAME_VEHICLE_TRADEIN', 'vehicle_tradein');

  9. #19
    Join Date
    Nov 2010
    Posts
    101
    Plugin Contributions
    0

    Default Re: Adding Multiple Images to Custom form To be sent to Admin Email

    2nd you need to create /includes/languages/english/your_custom_file_name.php

    HTML Code:
    <?php
    //
    // +----------------------------------------------------------------------+
    // |zen-cart Open Source E-commerce                                       |
    // +----------------------------------------------------------------------+
    // | Copyright (c) 2003 The zen-cart developers                           |
    // |                                                                      |
    // | http://www.zen-cart.com/index.php                                    |
    // |                                                                      |
    // | Portions Copyright (c) 2003 osCommerce                               |
    // +----------------------------------------------------------------------+
    // | This source file is subject to version 2.0 of the GPL license,       |
    // | that is bundled with this package in the file LICENSE, and is        |
    // | available through the world-wide-web at the following url:           |
    // | http://www.zen-cart.com/license/2_0.txt.                             |
    // | If you did not receive a copy of the zen-cart license and are unable |
    // | to obtain it through the world-wide-web, please send a note to       |
    // | [email protected] so we can mail you a copy immediately.          |
    // +----------------------------------------------------------------------+
    // $Id: band_signup.php,v 1.3 2007/06/07 00:00:00 DrByteZen Exp $
    //
    
    define('HEADING_TITLE', 'Vehicle Trade-In Appraisal');
    define('NAVBAR_TITLE', 'Vehicle Trade In');
    define('TEXT_SUCCESS', 'Thank you for your enquiry, we will contact you shortly.');
    define('EMAIL_SUBJECT', 'Site Vehicle Trade-In Form');
    
    define('ENTRY_NAME', 'Full Name:');
    define('ENTRY_EMAIL', 'E-Mail Address:');
    define('ENTRY_ENQUIRY', 'Message:');
    
    define('SEND_TO_ADDRESS', STORE_OWNER_EMAIL_ADDRESS);
    define('SIGN_US_UP','SIGN US UP!');

  10. #20
    Join Date
    Nov 2010
    Posts
    101
    Plugin Contributions
    0

    Default Re: Adding Multiple Images to Custom form To be sent to Admin Email

    3rd you have to create /includes/modules/pages/your_custom_folder_name/header_php.php

    HTML Code:
    <?php
    //
    // +----------------------------------------------------------------------+
    // |zen-cart Open Source E-commerce                                       |
    // +----------------------------------------------------------------------+
    // | Copyright (c) 2003 The zen-cart developers                           |
    // |                                                                      |
    // | http://www.zen-cart.com/index.php                                    |
    // |                                                                      |
    // | Portions Copyright (c) 2003 osCommerce                               |
    // +----------------------------------------------------------------------+
    // | This source file is subject to version 2.0 of the GPL license,       |
    // | that is bundled with this package in the file LICENSE, and is        |
    // | available through the world-wide-web at the following url:           |
    // | http://www.zen-cart.com/license/2_0.txt.                             |
    // | If you did not receive a copy of the zen-cart license and are unable |
    // | to obtain it through the world-wide-web, please send a note to       |
    // | [email protected] so we can mail you a copy immediately.          |
    // +----------------------------------------------------------------------+
    // $Id: header_php.php,v 1.3 2007/06/07 00:00:00 DrByteZen Exp $
    //
      require(DIR_WS_MODULES . 'require_languages.php');
      include(DIR_WS_CLASSES . 'upload.php');
      $breadcrumb->add(NAVBAR_TITLE);
      
    
      $error = false;
      $first_name = '';
      $last_name = '';
      $phone_number = '';
      $email_address = '';
      $mailing_city = '';
      $vehicle_year = '';
      $vehicle_make = '';
      $vehicle_model = '';
      $vehicle_mileage = '';
      $comments = '';
    
    
      if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
        $first_name = zen_db_prepare_input($_POST['first_name']);
        $last_name = zen_db_prepare_input($_POST['last_name']);
        $phone_number = zen_db_prepare_input($_POST['phone_number']);
        $email_address = zen_db_prepare_input($_POST['email_address']);
        $mailing_city = zen_db_prepare_input($_POST['mailing_city']);
        $vehicle_year = zen_db_prepare_input($_POST['vehicle_year']);
        $vehicle_make = zen_db_prepare_input($_POST['vehicle_make']);
        $vehicle_model = zen_db_prepare_input($_POST['vehicle_model']);
        $vehicle_mileage = zen_db_prepare_input($_POST['vehicle_mileage']);
        $comments = zen_db_prepare_input(strip_tags($_POST['comments']));
    	$att_array = array();
    	foreach($_FILES as $key => $file) {
      if (zen_not_null($_FILES[$key]['tmp_name'])) {
        if ($upload = new upload($key, DIR_FS_UPLOADS)) {
            $att_array[] = array('file' => $upload->destination . $upload->filename, 'name' => $upload->filename);
        }
      }
    }
    	//Get the uploaded file information
    	$name_of_uploaded_file =    basename($_FILES['uploaded_file']['name']); 
    	//get the file extension of the file
    	$type_of_uploaded_file =    substr($name_of_uploaded_file,   
    	strrpos($name_of_uploaded_file, '.') + 1); $size_of_uploaded_file =    $_FILES["uploaded_file"]["size"]/1024;//size in KBs
    	
    	$path_of_uploaded_file = $upload_folder . $name_of_uploaded_file;
    	$tmp_path = $_FILES["uploaded_file"]["tmp_name"];
    	if(is_uploaded_file($tmp_path))
    	{  
    	if(!copy($tmp_path,$path_of_uploaded_file))  {    $errors .= '\n error while copying the uploaded file';  }}
    	
    	
    
        if (!zen_validate_email($email_address))  {
          $error = true;
          $messageStack->add('email address', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
          }
        if (!zen_not_null($first_name))  {
          $error = true;
          $messageStack->add('first name', 'Please fill in the first_name');
          }
        if (!zen_not_null($last_name))  {
          $error = true;
          $messageStack->add('last name', 'Please fill in the last_name');
          }
        if (!zen_not_null($phone_number))  {
          $error = true;
          $messageStack->add('phone number', 'Please fill in the phone_number');
          }
        if (!zen_not_null($email_address))  {
          $error = true;
          $messageStack->add('email address', 'Please fill in the email_address');
          }
        if (!zen_not_null($mailing_city))  {
          $error = true;
          $messageStack->add('mailing city', 'Please fill in the mailing_city');
          }
    /*
        if (!zen_not_null($contact2_firstname))  {
          $error = true;
          $messageStack->add('band_signup', 'Please fill in the contact2_firstname');
          }
        if (!zen_not_null($contact2_lastname))  {
          $error = true;
          $messageStack->add('band_signup', 'Please fill in the contact2_lastname');
          }
        if (!zen_not_null($contact2_phone))  {
          $error = true;
          $messageStack->add('band_signup', 'Please fill in the contact2_phone');
          }
        if (!zen_not_null($contact2_email))  {
          $error = true;
          $messageStack->add('band_signup', 'Please fill in the contact2_email');
          }
    */
        if (!zen_not_null($vehicle_year))  {
          $error = true;
          $messageStack->add('vehicle year', 'Please fill in the vehicle_year');
          }
        if (!zen_not_null($vehicle_make))  {
          $error = true;
          $messageStack->add('vehicle make', 'Please fill in the vehicle_make');
          }
        if (!zen_not_null($vehicle_model))  {
          $error = true;
          $messageStack->add('vehicle model', 'Please fill in the vehicle_model');
          }
        if (!zen_not_null($vehicle_mileage))  {
          $error = true;
          $messageStack->add('vehicle mileage', 'Please fill in the vehicle_mileage');
          }
    
       if ($error == false) {
    
    
    
    
    //assemble the email contents:
          $email_text = 'Vehicle Data Submission: ' . "\n" .
            '------------------------------------------------------' . "\n" .
            'First Name:' . "\t" . $first_name . "\n" .
            'Last Name:' . "\t" . $last_name . "\n" .
            'Phone Number:' . "\t" . $phone_number . "\n" .
            'Email Address:' . "\t" . $email_address . "\n" .
            'Mailing City:' . "\t" . $mailing_city. "\n" .
            'Vehicle Year:' . "\t" . $vehicle_year . "\n" .
            'Vehicle Make:' . "\t" . $vehicle_make . "\n" .
            'Vehicle Model:' . "\t" . $vehicle_model . "\n" .
            'Vehicle Mileage:' . "\t" . $vehicle_mileage . "\n" .
            'Comments:' . "\t" . $comments . "\n\n" .
            '------------------------------------------------------' . "\n" .
            OFFICE_USE . "\t" . "\n" .
            OFFICE_LOGIN_NAME . "\t" . $customer_name . "\n" .
            OFFICE_LOGIN_EMAIL . "\t" . $customer_email . "\n" .
            OFFICE_IP_ADDRESS . "\t" . $_SERVER['REMOTE_ADDR'] . "\n" .
            OFFICE_HOST_ADDRESS . "\t" . gethostbyaddr($_SERVER['REMOTE_ADDR']) . "\n" .
            OFFICE_DATE_TIME . "\t" . date("D M j Y G:i:s T") . "\n" .
            '------------------------------------------------------' . "\n\n" .
          $email_text = zen_output_string_protected($email_text);
          $email_html = nl2br("\n" . $email_text);
    	  
    	  
    	
        
    	  
    //send the email
          zen_mail(STORE_NAME, SEND_TO_ADDRESS, EMAIL_SUBJECT, $email_text, $first_name . ' ' . $last_name, $email_address, array('EMAIL_MESSAGE_HTML' => $email_html), 'vehicle_tradein', $att_array);
    
          zen_redirect(zen_href_link(FILENAME_VEHICLE_TRADEIN, 'action=success'));
          } //endif $error=false
    
      } // endif action
    
    
    
    ?>

 

 
Page 2 of 6 FirstFirst 1234 ... LastLast

Similar Threads

  1. v139h New Contact Form Email - Messages not being sent?
    By jazzyman in forum General Questions
    Replies: 9
    Last Post: 6 Feb 2013, 05:28 PM
  2. email address - sent from, multiple emails
    By illusionest in forum Basic Configuration
    Replies: 2
    Last Post: 10 Nov 2010, 02:18 AM
  3. Adding Multiple Images though Admin that also works with zen lightbox 1.4
    By headyntl in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 3 Jul 2008, 07:58 AM
  4. EMail Admin the same Email message that is sent to customer
    By dubya01 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 21 Aug 2007, 03:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg