Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

upload second image


simonzebu

Recommended Posts

Hi All,

My client wants to have a sample mp3 file for each product in addition to the image. I have created a field called products_soundfile in the products table and added duplicate chunks of code in categories.php wherever products_image appeared, changing the duplicate bits to products_soundfile.

 

I now have an extra upload bit in the admin for uploading an mp3 file. It appears to work in that the filename is written to the database but I get an OScommerce error 'Warning: No file uploaded', and sure enough it is not uploaded. I figure the problem has to be in upload.php but I cannot see where I would need to alter the code to get the file to upload.

 

I have done several searches but cannot find any posts about second images, any clues anyone?

Link to comment
Share on other sites

Um??? Why didn't you just create a folder called something like 'samples' and upload all of your samples to there, and then just provide a link to it within the Product Description box (when you add the product), or use the Products URL box?

 

Vger

Link to comment
Share on other sites

Um??? Why didn't you just create a folder called something like 'samples' and upload all of your samples to there, and then just provide a link to it within the Product Description box (when you add the product), or use the Products URL box?

 

Vger

Hi Vger, Thanks, but the client needs to be doing all the uploading of new products himself as and when they are launched.

I have worked out the problem. I had added another case in categories but this worked:

 

// copy image only if modified

$products_image = new upload('products_image');

$products_image->set_destination(DIR_FS_CATALOG_IMAGES);

if ($products_image->parse() && $products_image->save()) {

$products_image_name = $products_image->filename;

} else {

$products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : '');

}

 

 

$products_soundfile = new upload('products_soundfile');

$products_soundfile->set_destination(DIR_FS_CATALOG_IMAGES);

if ($products_soundfile->parse() && $products_soundfile->save()) {

$products_soundfile_name = $products_soundfile->filename;

} else {

$products_soundfile_name = (isset($HTTP_POST_VARS['products_previous_soundfile']) ? $HTTP_POST_VARS['products_previous_soundfile'] : '');

}

break;

 

along with the other changes mentioned.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...