I know how to upload file given from jform if a component is already installed. But how to upload a file from my admin/assets/ folder of my component when installing the component? In my script.php I try the following code:
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
...
public function install($parent)
{
// creating a folder
$path = JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . "templates" . DIRECTORY_SEPARATOR . "isis" . DIRECTORY_SEPARATOR . "html" . DIRECTORY_SEPARATOR . "com_content" . DIRECTORY_SEPARATOR . "article";
$mode = 0755;
JFolder::create($path, $mode);
// uploading a file
$file = JPATH_COMPONENT_ADMINISTRATOR . DIRECTORY_SEPARATOR . "assets" . DIRECTORY_SEPARATOR . "edit.php";
$filename = JFile::makeSafe($file['name']);
$src = $file['tmp_name'];
$dest = JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . "templates" . DIRECTORY_SEPARATOR . "isis" . DIRECTORY_SEPARATOR . "html" . DIRECTORY_SEPARATOR . "com_content" . DIRECTORY_SEPARATOR . "article" . DIRECTORY_SEPARATOR . $filename;
JFile::upload($src, $dest);
}
The folder is being created successfully but the file is not being uploading to the folder and I get the can't move error