Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

image upload not working


emmetje

Recommended Posts

I've been searching for a while and found that the file is uploaded to the images map but there are no records in the database. When I put it into the database myself it works in the admin but not in the catalog.

 

It might be usefull for debugging to post the sql so here it is:

 

#----------------------------
# Table structure for pages
#----------------------------
CREATE TABLE `pages` (
 `pages_id` int(11) NOT NULL auto_increment,
 `pages_name` varchar(32) NOT NULL default '',
 `pages_image` varchar(64) NOT NULL default '',
 `sort_order` int(3) NOT NULL default '0',
 `pages_status` tinyint(1) NOT NULL default '0',
 PRIMARY KEY  (`pages_id`)
) TYPE=MyISAM ;


#----------------------------
# Records for table pages
#----------------------------
INSERT INTO `pages` VALUES (1, 'home', '', -100, 1);
INSERT INTO `pages` VALUES (2, 'contact_us', '', -100, 1);
INSERT INTO `pages` VALUES (3, 'shipping', '', 1, 1);
INSERT INTO `pages` VALUES (4, 'conditions', '', 3, 1);
INSERT INTO `pages` VALUES (5, 'privacy', '', 2, 1);

#----------------------------
# Table structure for pages_description
#----------------------------

CREATE TABLE `pages_description` (
 `pages_id` int(11) NOT NULL default '0',
 `language_id` int(11) NOT NULL default '0',
 `pages_title` varchar(255) NOT NULL default '',
 `pages_body` text NOT NULL,
 PRIMARY KEY  (`pages_id`,`language_id`)
) TYPE=MyISAM ;

#----------------------------
# Records for table pages_description
#----------------------------
INSERT INTO `pages_description` VALUES (1, 1, 'Home Page', 'Place your home page text here...');
INSERT INTO `pages_description` VALUES (2, 1, 'Contact Us', 'Place your contact us text here...');
INSERT INTO `pages_description` VALUES (3, 1, 'Shipping & Returns', 'Place your shipping and returns text here...');
INSERT INTO `pages_description` VALUES (4, 1, 'Conditions of Use', 'Place your conditions of use text here...');
INSERT INTO `pages_description` VALUES (5, 1, 'Privacy Notice', 'Place your privacy notice text here...');

 

I hope somebody can help me out.

Sorry for the language errors but i'm not english speaking or in this case writing ;)

Link to comment
Share on other sites

  • 2 weeks later...

It's working!! Found the solution when searching with Google on a danish forum. In case somebody has the same problem I'll post it here.

 

In catalog/admin/pages.php

Find:

tep_db_query("update " . TABLE_PAGES . " set pages_image = '" . tep_db_input($pages_image->filename) . "' where pages_id = '" . (int)$pages_id . "'"); 

 

Replace with:

tep_db_query("update " . TABLE_PAGES . " set pages_image = '" . tep_db_prepare_input($HTTP_POST_VARS['pages_image']) . "' where pages_id = '" . (int)$pages_id . "'");

 

In catalog/pages.php

Find:

define('TEXT_INFORMATION', nl2br($page['pages_body'])); 

 

Add after:

define('PAGES_IMAGE', $page["pages_image"]); 

 

Find:

<?php echo $page["pages_image"] ? tep_image(DIR_WS_IMAGES . $page["pages_image"], HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT) : tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?>

 

Replace with:

<?php echo PAGES_IMAGE ? tep_image(DIR_WS_IMAGES . PAGES_IMAGE, HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT) : tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?>

 

Thats all. Hope it will help others. I'll also try to post this to the original contribution.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...