Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Uploading images


Timmy

Recommended Posts

Posted

My osCommerce homepage has been edited to show all active specials. As I want special images to be displayed next to the specials I currently upload these via FTP. But I'd like to edit /admin/specials.php so I can upload images along with creating new specials.

 

It seems an easy job, I modified the specials table did some tweaking to the forms and tried to edit the PHP-code so it saves the uploaded image.

 

        $specials_image = new upload('specials_image');
       $specials_image->set_destination(DIR_FS_CATALOG_IMAGES);
       if ($specials_image->parse() && $specials_image->save()) {
         $specials_image_name = $specials_image->filename;
       } else {
         $specials_image_name = (isset($HTTP_POST_VARS['specials_previous_image']) ? $HTTP_POST_VARS['specials_previous_image'] : '');
       }

 

The changed form uses this code:

          <tr>
           <td class="main"><?php echo TEXT_SPECIALS_IMAGE; ?></td>
           <td class="main"><?php echo tep_draw_file_field('specials_image') . '<BR>' . $pInfo->specials_image . tep_draw_hidden_field('specials_previous_image', $pInfo->specials_image); ?></td>
         </tr>

 

The weird thing is that uploaded images don't appear on my server. The PHP is the same as the PHP used for new products and the directory is writable but images are lost somewhere.

 

Does anyone know how to fix this problem? thx!

Archived

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

×
×
  • Create New...