Page 1 of 3 123 LastLast
Results 1 to 10 of 24
  1. #1
    Join Date
    Aug 2007
    Posts
    37
    Plugin Contributions
    0

    Default Custom link to uploaded file not displayed correctly in shopping cart

    Hi!

    I have modified the shopping_cart.php to show the uploaded image in the shopping cart, or a link if the uploaded file is not an image.
    This was working perfectly fine when testing this on my local computer running a server.
    Now I migrated to a web server and this feature is not working anymore
    When uploading the image / file, the html code that is being generated by the shopping_cart.php is being displayed on the page
    I have no idea how this could happen, please help me!
    I am guessing there is a permissions problem or so, but what is even more strange is, that during the check out, the image or link is displayed correctly...

    If you want to try and see for yourself, you can visit http://www.priedel.com/laserwerks
    user: test
    password: test

    This is the code of my shopping_cart.php:

    Code:
              $real_ids = isset($_POST['id']) ? $_POST['id'] : "";
              if (isset($_GET['number_of_uploads']) && $_GET['number_of_uploads'] > 0) {
                /**
                 * Need the upload class for attribute type that allows user uploads.
                 *
                 */
                include(DIR_WS_CLASSES . 'upload.php');
                for ($i = 1, $n = $_GET['number_of_uploads']; $i <= $n; $i++) {
                  if (zen_not_null($_FILES['id']['tmp_name'][TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]]) and ($_FILES['id']['tmp_name'][TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] != 'none')) {
                    $products_options_file = new upload('id');
                    $products_options_file->set_destination(DIR_FS_UPLOADS);
                    $products_options_file->set_output_messages('session');
                    if ($products_options_file->parse(TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i])) {
                      $products_image_extension = substr($products_options_file->filename, strrpos($products_options_file->filename, '.'));
                      if ($_SESSION['customer_id']) {
                        $db->Execute("insert into " . TABLE_FILES_UPLOADED . " (sesskey, customers_id, files_uploaded_name) values('" . zen_session_id() . "', '" . $_SESSION['customer_id'] . "', '" . zen_db_input($products_options_file->filename) . "')");
                      } else {
                        $db->Execute("insert into " . TABLE_FILES_UPLOADED . " (sesskey, files_uploaded_name) values('" . zen_session_id() . "', '" . zen_db_input($products_options_file->filename) . "')");
                      }
                      $insert_id = $db->Insert_ID();
    				  $datei = strtolower($products_image_extension);
    
    
    //Zeige als Bild wenn bilddatei, sonst zeige link!
    				  $rand = rand();
    				  $randsave = $rand;
    
    				  if ($datei == '.jpg' || $datei == '.jpeg' || $datei == '.gif' || $datei == '.png' ){
    				   $real_ids[TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] = '<a target="blank" href="images/uploads/' . $randsave . $insert_id . $products_image_extension . '"><img src="images/uploads/' . $randsave . $insert_id . $products_image_extension . '" width="160"></img></a><br>Image ID: [ '. $randsave . $insert_id . ' ]  <br>Image name: ' . $products_options_file->filename;
    				   }
    				   
    				   else {
    				   $real_ids[TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] = '<a target="blank" href="images/uploads/' . $randsave . $insert_id . $products_image_extension . '">'. $randsave . $insert_id . $products_image_extension .' </a>' . $products_options_file->filename;
    				   }
    
                      $products_options_file->set_filename($randsave . "$insert_id" . $products_image_extension);
                      if (!($products_options_file->save())) {
                        break;
                      }
                    } else {
                      break;
                    }
                  } else { // No file uploaded -- use previous value
                    $real_ids[TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] = $_POST[TEXT_PREFIX . UPLOAD_PREFIX . $i];
                  }
                }
              }
    Please, I need help

    THANK YOU!

    - Paul

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Uploaded file not displayed correctly in shopping cart after migrating to live se

    Link is secured

    What line #'s does this code represent?

  3. #3
    Join Date
    Aug 2007
    Posts
    37
    Plugin Contributions
    0

    Default Re: Uploaded file not displayed correctly in shopping cart after migrating to live se

    Quote Originally Posted by kobra View Post
    Link is secured
    The username is "test", the password is also "test"

    Quote Originally Posted by kobra View Post
    What line #'s does this code represent?
    That would be:
    1605 - 1651

    Thank you!

  4. #4
    Join Date
    Aug 2007
    Posts
    37
    Plugin Contributions
    0

    Default Re: Uploaded file not displayed correctly in shopping cart after migrating to live se

    Oh, and is is manipulated by me starting at:

    //Zeige als Bild wenn bilddatei, sonst zeige link!

  5. #5
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Uploaded file not displayed correctly in shopping cart after migrating to live se

    I looked and did not see an issue nor anything that is different than a default install

    Check your PM's

  6. #6
    Join Date
    Aug 2007
    Posts
    37
    Plugin Contributions
    0

    Default Re: Uploaded file not displayed correctly in shopping cart after migrating to live se

    You will see the issue when adding an image or another file to the only product that exists in the store.
    Then look into the shopping cart.

  7. #7
    Join Date
    Aug 2007
    Posts
    37
    Plugin Contributions
    0

    Default Re: Uploaded file not displayed correctly in shopping cart after migrating to live se

    Please, someone? I need help

  8. #8
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Uploaded file not displayed correctly in shopping cart after migrating to live se

    You might add a details list for:

    ZenCart Version
    Server type
    php version
    mysql version

  9. #9
    Join Date
    Aug 2007
    Posts
    37
    Plugin Contributions
    0

    Default Re: Uploaded file not displayed correctly in shopping cart after migrating to live se

    My live Server:

    Linux Server
    PHP version 4.4.6
    MySQL version 4.1.22
    ZC version: 1.3.7.1

    My local machine that I developed on and where this is working:

    Windows NT Server
    PHP version 5.2.1
    MySQL version: 5.0.37
    ZC version: 1.3.7
    Last edited by PaulRiedel; 14 Aug 2007 at 02:18 PM. Reason: adding server information

  10. #10
    Join Date
    Aug 2007
    Posts
    37
    Plugin Contributions
    0

    Default Re: Uploaded file not displayed correctly in shopping cart after migrating to live se

    Hey guys!

    I have tried and tried, but I was still not able to find a solution.

    I don't think I'm the first one to try to display an uploaded image to the user after the upload. Does someone maybe know of a better/easier/working way to do this?

    Thanks!!

    - Paul

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. v151 Price not getting displayed correctly; with attributes
    By devyani in forum Customization from the Admin
    Replies: 32
    Last Post: 22 Jul 2014, 02:52 PM
  2. CSS Buy Now Button not correctly displayed.
    By joey779 in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 11 Aug 2011, 11:13 PM
  3. Replies: 3
    Last Post: 7 Feb 2011, 06:23 AM
  4. After file upload, want to make filename a clickable link to preview uploaded content
    By PaulRiedel in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 3 Feb 2010, 03:17 PM
  5. Pages not displayed correctly
    By mattmah in forum Installing on a Linux/Unix Server
    Replies: 1
    Last Post: 18 Sep 2009, 09:49 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