Karthik mathesh Karthik mathesh - 1 year ago 126
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");

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download