Hello and thanks for that contribution.
it works fine, but I have a strange problem with application_top.php - add_product:
I get a 500 error with this part of code (but the upload works) or - if I comment this out - the script works, but no uploads.
//if (!($products_options_file->save())) {
//break 2;
//}
}
//else {
//break 2;
//}
Here is the whole add_prduct code:
case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
$real_ids = $HTTP_POST_VARS['id'];
if ($HTTP_POST_VARS['number_of_uploads'] > 0)
{
require(DIR_WS_CLASSES . 'upload.php');
for ($i = 1; $i <= $HTTP_POST_VARS['number_of_uploads']; $i++)
{
$TEMP_FILE = $_FILES['id']['tmp_name'][TEXT_PREFIX . $HTTP_POST_VARS[uPLOAD_PREFIX . $i]];
if (tep_not_null($TEMP_FILE) && $TEMP_FILE != 'none')
{
$products_options_file = new upload('id');
if (tep_session_is_registered('customer_id'))
{
$products_options_file->set_destination(UPL_DIR);
} else
{
$products_options_file->set_destination(TMP_DIR);
}
if ($products_options_file->parse(TEXT_PREFIX . $HTTP_POST_VARS[uPLOAD_PREFIX . $i]))
{
if (tep_session_is_registered('customer_id'))
{
tep_db_query("insert into " . TABLE_FILES_UPLOADED . " (sesskey, customers_id, files_uploaded_name, date) values('" . tep_session_id() . "', '" . $customer_id . "', '" . tep_db_input($products_options_file->filename) . "', '" . date("d-m-y") . "')");
} else {
tep_db_query("insert into " . TABLE_FILES_UPLOADED . " (sesskey, files_uploaded_name, date) values('" . tep_session_id() . "', '" . tep_db_input($products_options_file->filename) . "', '" . date("d-m-y") . "')");
}
//BOF - Zappo - Option Types v2 - Set File Prefix
if (OPTIONS_TYPE_FILEPREFIX == 'Database') { // Database ID as File prefix
$insert_id = tep_db_insert_id() . '_';
} else { // Date, time or both as File prefix (Change date formatting here)
if (OPTIONS_TYPE_FILEPREFIX == 'Date' || OPTIONS_TYPE_FILEPREFIX == 'DateTime') {
$insert_id = 'D'.date("d-m-y_");
}
$insert_id .= (OPTIONS_TYPE_FILEPREFIX == 'DateTime' || OPTIONS_TYPE_FILEPREFIX == 'Time') ? 'T'.date("H-i_") : '';
}
//EOF - Zappo - Option Types v2 - Set File Prefix
//Update filename in Database with correct prefix (For comparing database names with real files)
tep_db_query("update " . TABLE_FILES_UPLOADED . " set files_uploaded_name = '" . tep_db_input($insert_id . $products_options_file->filename) . "' where sesskey = '" . tep_session_id() . "' and files_uploaded_name = '" . tep_db_input($products_options_file->filename) . "' and date = '" . date("d-m-y") . "'");
$real_ids[TEXT_PREFIX . $HTTP_POST_VARS[uPLOAD_PREFIX . $i]] = $insert_id . $products_options_file->filename;
$products_options_file->set_filename($insert_id . $products_options_file->filename);
//if (!($products_options_file->save())) {
//break 2;
//}
}
//else {
//break 2;
//}
}
else { // No file uploaded -- use previously uploaded file (From Dropdown)
$real_ids[TEXT_PREFIX . $HTTP_POST_VARS[uPLOAD_PREFIX . $i]] = $HTTP_POST_VARS[TEXT_PREFIX . UPLOAD_PREFIX . $i];
}
}
}
$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $real_ids)) + $HTTP_POST_VARS['cart_quantity'], $real_ids);
}
tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
break;
I have no idea ... Maybe someone can help me?
Ibissen,
PS. Sorry for my English.