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:
Please, I need helpCode:$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]; } } }
THANK YOU!
- Paul






