Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Uploading a pic to two different folders


Monika in Germany

Recommended Posts

Posted

// 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'] : '');
	}
	break;
}
 }

 

this is the code in categories.php for the upload ... I need to copy the same pic to a different folder ... tried a bunch of versions no joy. Anyone know how to do it?

 

TIA

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Posted

Why not try adapting the 'Auto Thumbnail' contribution for your own needs. Unlike other thumbnailers which produce thumbnails but don't save them this one saves the thumbnail in a seperate folder. That folder could be adapted, and the other adaptation would be to create the full image and not a thumbnail. At the very least there should be some code ideas in it which might help you.

 

Vger

Posted
// 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'] : '');
	}
	break;
}
 }

 

this is the code in categories.php for the upload ... I need to copy the same pic to a different folder ... tried a bunch of versions no joy. Anyone know how to do it?

 

TIA

 

Wow, I thought simpoy take the first lines again and your set but that's what you have been trying also I guess and that doesn't work :blink:

Don't know if you like the following solution but it seems to do the trick and it's easy too:

		$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'] : '');
	}

	if (copy(DIR_FS_CATALOG_IMAGES . $products_image->filename, DIR_FS_DOCUMENT_ROOT . $products_image->filename)) {
		echo 'Copy succeeded !';
		   } else {
					echo 'You're f@cked';'
	}

 

HTH

Posted

Howard, love ya.

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Posted
Howard, love ya.

 

Thank you :blush: Glad it could help you and so easy in the end (maybe I should buy me a PHP book after all instead of learning through osC and doing searches alone :D ).

Archived

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

×
×
  • Create New...