Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16
  1. #11
    Join Date
    Jun 2008
    Location
    Utah, US.
    Posts
    25
    Plugin Contributions
    0

    Default Re: Add a upload module on contact us page

    My Pleasure.
    NooNe

  2. #12
    Join Date
    Apr 2004
    Location
    UK
    Posts
    5,821
    Plugin Contributions
    2

    Default Re: Add a upload module on contact us page

    Quote Originally Posted by NooNe View Post
    My Pleasure.
    Not tested yet, but thanks for sharing.

  3. #13
    Join Date
    Jun 2008
    Location
    Utah, US.
    Posts
    25
    Plugin Contributions
    0

    Default Re: Add a upload module on contact us page

    A Note on the progress bar (bug discovered):

    Depending on your version, this may work
    PHP Code:
    <div class="buttonRow forward"><? echo zen_image_submit(BUTTON_IMAGE_SEND, BUTTON_SEND_ALT,'','onclick="document.getElementById(\'moreinfo\').style.display = \'block\';"') ;?> </div>
    Or you may have to remove the
    PHP Code:
    ,'' 
    PHP Code:
    To look like this
    <div class="buttonRow forward"><? echo zen_image_submit(BUTTON_IMAGE_SEND, BUTTON_SEND_ALT,'onclick="document.getElementById(\'moreinfo\').style.display = \'block\';"') ;?> </div>
    NooNe

  4. #14
    Join Date
    Oct 2004
    Posts
    1,045
    Plugin Contributions
    0

    Default Re: Add a upload module on contact us page

    Quote Originally Posted by NooNe View Post
    Hiya, alsBB – Misty,

    Okie, I am writing this mod in 2 sections – Section 1) upload mod, and section 2) “dummy” progress bar mod.

    Section 1) Upload Mod

    1) In includes/templates/YOUR_TEMPLATE/templates/tpl_contact_us_default.php
    Find:
    PHP Code:
    <label class="inputLabel" for="email-address"><?php echo ENTRY_EMAIL?></label>
    <?php echo zen_draw_input_field('email', ($error $_POST['email'] : $email), ' size="40" id="email-address"') . '<span class="alert">' ENTRY_REQUIRED_SYMBOL '</span>'?>
    <br class="clearBoth" />
    <label for="enquiry"><?php echo ENTRY_ENQUIRY '<span class="alert">' ENTRY_REQUIRED_SYMBOL '</span>'?></label>
    <?php echo zen_draw_textarea_field('enquiry''30''7''''id="enquiry"'); ?>
    Change to:
    PHP Code:
    <label class="inputLabel" for="email-address"><?php echo ENTRY_EMAIL?></label>
    <?php echo zen_draw_input_field('email', ($error $_POST['email'] : $email), ' size="40" id="email-address"') . '<span class="alert">' ENTRY_REQUIRED_SYMBOL '</span>'?>
    <br class="clearBoth" />
    <label for="enquiry"><?php echo ENTRY_ENQUIRY '<span class="alert">' ENTRY_REQUIRED_SYMBOL '</span>'?></label>
    <?php echo zen_draw_textarea_field('enquiry''30''7''''id="enquiry"'); ?></fieldset><fieldset>
    <? if ($_SESSION['customer_id'] != ''){ ?>
    <label class="inputLabel" for="image1"><?php echo 'Front image' ?></label>
    <?php echo zen_draw_file_field('ufile[]'); ?>
    <br class="clearBoth" />
    <label class="inputLabel" for="image2"><?php echo 'Back image' ?></label>
    <?php echo zen_draw_file_field('ufile[]'); ?>
    <br class="clearBoth" />
    Then in includes/modules/pages/contact_us/header_php.php

    Find:
    PHP Code:
    <?
    if (isset($_GET['action']) && ($_GET['action'] == 'send')) { ?>
    <?
    change to::
    PHP Code:
    <?
    if (isset($_GET['action']) && ($_GET['action'] == 'send')) { ?>
    <?
     $path1= "images/ YOUR_UPLOAD_FILE ".$HTTP_POST_FILES['ufile']['name'][0];
    $path2= "images/YOUR_UPLOAD_FILE ".$HTTP_POST_FILES['ufile']['name'][1];

    //copy file to where you want to store file
    copy($HTTP_POST_FILES['ufile']['tmp_name'][0], $path1);
    copy($HTTP_POST_FILES['ufile']['tmp_name'][1], $path2);
    then find:
    PHP Code:
    OFFICE_FROM "\t" $name "\n\n" .
    OFFICE_EMAIL "\t" $email_address "\n\n" .
    '------------------------------------------------------' "\n\n" 
    and change to:
    PHP Code:
    OFFICE_FROM "\t" $name "\n\n" .
    OFFICE_EMAIL "\t" $email_address "\n\n" .
     
    'Front image; '.$HTTP_POST_FILES['ufile']['name'][0] .  "\n\n" .
    'Back image; '.$HTTP_POST_FILES['ufile']['name'][1] .  "\n\n" .
    '------------------------------------------------------' "\n\n" 

    When we added <?php echo zen_draw_file_field('ufile[]'); ?> the name ufile[] is loading & POSTing your image into an array, using this method you can add 100+ of the zen_draw_file_fields without having to rename them.

    When the customer hits the “send now” button, the cart goes to the “send” portion of the cart and this is where we catch your newly POSTed files.

    $HTTP_POST_FILES['ufile']['name'][0]; is the first ufile[] that you placed on the first page (Zero is the first number…lol) and then is goes to HTTP_POST_FILES['ufile']['name'][1]; and then[2], then [3] and so on, up too 100+..

    You will need to change images/YOUR_UPLOAD_FILE into images/uploaded or into images/contact and make sure that you have the same name on your file folder in your “images/”



    MOD dummy progress bar:
    In this section you will also need to ceate a file “popup.html”
    Section 2-A) in popup.html add:
    PHP Code:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>

    </head><center><img src="/images/popup_image.png" /><br/><? // my header/logo image
    <img src="/images/progress_bar_animated.gif" width="500" height="30" /><br/> <? // my animated.gif progress bar found on the internet
    (Depending on your file size, this page may take up to 10 minutes to refresh).</center> <? // me asking the customer no to touch anything more
    </body>
    </html>
    then upload it in your ROOT docs (next to your main index page).

    Section 2-B) In includes/templates/YOUR_TEMPLATE/templates/tpl_contact_us_default.php

    Find:
    PHP Code:
    </fieldset>

    <div class="buttonRow forward"><?php echo zen_image_submit(BUTTON_IMAGE_SENDBUTTON_SEND_ALT); ?></div>
    <div class="buttonRow back"><?php echo zen_back_link() . zen_image_button(BUTTON_IMAGE_BACKBUTTON_BACK_ALT) . '</a>'?></div>
    and change to:
    PHP Code:
    </fieldset>
    <script type="text/javascript"><!--
    document.write("<div style='display:none' id='moreinfo'>");
    //-->
    </script><? include ('popup.html'); ?><script type="text/javascript"><!--
    document.write("</div>");
    //--></script>
    </fieldset>
    <div class="buttonRow forward"><? echo zen_image_submit(BUTTON_IMAGE_SEND, BUTTON_SEND_ALT,'','onclick="document.getElementById(\'moreinfo\').style.display = \'block\';"') ;?> </div>
    <div class="buttonRow back"><?php echo zen_back_link() . zen_image_button(BUTTON_IMAGE_BACKBUTTON_BACK_ALT) . '</a>'?></div>

    What this script does is includes and “hides” popup.html and then when the customer presses the “send now” button, it “shows” popup.html.

    This is a very basic progress bar setup, my customers upload 30m – 350m files and it takes a while, and this stops them from thinking it’s a “Dead page” and isn’t doing anything, and re-clicking the send now button again.

    I hope this helps…….
    I am trying to install this mod, but it's just not working. The image is not being uploaded, and the name of the image does not show up in the e-mail. The header_php.php is slightly different though, it looks like this now (version 1.3.9d):

    if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
    $name = zen_db_prepare_input($_POST['contactname']);
    $email_address = zen_db_prepare_input($_POST['email']);
    $enquiry = zen_db_prepare_input(strip_tags($_POST['enquiry']));
    I tried implementing the changes in the mod so the file looks like this:

    if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
    $name = zen_db_prepare_input($_POST['contactname']);
    $email_address = zen_db_prepare_input($_POST['email']);
    $path1= "artwork_uploads/".$HTTP_POST_FILES['ufile']['name'][0];
    $enquiry = zen_db_prepare_input(strip_tags($_POST['enquiry']));

    //copy file to where you want to store file
    copy($HTTP_POST_FILES['ufile']['tmp_name'][0], $path1);
    But it is just not working. Did I modify the file incorrectly?

    Thanks!
    Danielle

  5. #15
    Join Date
    Jun 2012
    Posts
    2
    Plugin Contributions
    0

    Default Add upload image to contact us - update

    Hello,

    if anyone tried this http://www.zen-cart.com/showthread.p...-us-page/page2 in latest version of PHP it will fail (learned the hard way).

    Require to perform two updates:

    1. tpl_contact_us_defualt.php will require this change:

    before:
    <?php echo zen_draw_form('contact_us', zen_href_link(FILENAME_CONTACT_US, 'action=send') ); ?>
    after:
    <?php echo zen_draw_form('request', zen_href_link(FILENAME_REQUEST, 'action=send'), 'post', ' enctype="multipart/form-data"' ); ?>

    2. You need to add another hidden element:
    <input type="hidden" name="MAX_FILE_SIZE" value="100000" />

    where value = max file size in bytes.

    Then upload will work.

    pubs

  6. #16
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Add upload image to contact us - update

    Shouldn't that be ... ?
    <?php echo zen_draw_form('request', zen_href_link(FILENAME_CONTACT_US, 'action=send'), 'post', ' enctype="multipart/form-data"' ); ?>
    Also your max file size setting should be no greater than the equivalent value set in your php.ini file, otherwise the latter will override your value.

    It may also be helpful to note that Zen Cart has a built-in class named "upload" for handling file uploads.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Allow Customers To Upload Images Using Contact Us Page?
    By CoolCarPartsOnline in forum General Questions
    Replies: 34
    Last Post: 4 Jan 2017, 05:00 PM
  2. how to add file upload to contact us page?
    By warroyo90 in forum General Questions
    Replies: 6
    Last Post: 19 Jun 2012, 06:28 AM
  3. allow file upload on contact us page
    By bluelightnin6 in forum General Questions
    Replies: 5
    Last Post: 13 Jan 2012, 01:00 AM
  4. Contact Us Page - Add on?
    By AnitaB in forum General Questions
    Replies: 2
    Last Post: 3 Oct 2009, 05:18 AM
  5. Captcha module on contact page
    By Backstage in forum General Questions
    Replies: 4
    Last Post: 26 Mar 2009, 11:05 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR