Karthik mathesh Karthik mathesh - 4 months ago 11
PHP Question

PHP Copy function Not Working in Joomla

I need to copy image one path to another path.

Here is My code :

$sourspath = JUri::root().'media/truematrimony/profiles/pending/'.$totbookmar.'';

$descpath = JUri::root().'media/truematrimony/profiles/kmprofile/'.$totbookmar.'';

$status = copy($sourspath, $descpath) or die("Could not copy file contents");


My educated guess (I know nothing about Joomla) is that JUri is a helper class to manipulate URLs. If that's your intention, you're using it wrong because your paths are missing the http:// prefix. But I don't think you really want to copy files across the network (and the HTTP wrapper is read-only anyway). You have to use file system paths, not URLs. Joomla seems to have several path-related constants so you can build an absolute path.