function action($articleid, $fieldsid, $fieldsvalueid) { $path = $this->params->get("path"); $file = "field_" . $fieldsid . "_upload"; $documentpath = $this->params->get("documentpath"); if (empty($documentpath)) { /*$sitepath = JURI::base() ; $pos = strrpos($sitepath, "administrator"); if(!empty($pos)){$sitepath = JURI::base().'..'.DS;}*/ $sitepath = fieldsattachHelper::getabsoluteURL(); $this->params->set("path", $sitepath . 'images' . DS . 'documents'); //$documentpath= JPATH_INSTALLATION.DS.'..'.DS.'images'.DS.'documents'; $documentpath = JPATH_BASE . DS . 'images' . DS . 'documents'; } plgfieldsattachment_file::deleteFile($file, $articleid, $fieldsid, $fieldsvalueid, $documentpath); plgfieldsattachment_file::uploadFile($file, $articleid, $fieldsid, $fieldsvalueid, $documentpath); }
function action($articleid, $fieldsid, $fieldsvalueid) { $app = JFactory::getApplication(); $path = $this->path1; $file = "field_" . $fieldsid . "_upload"; //FIND FOLDER ************************************************************ $documentpath = JPATH_ROOT . DS . 'images' . DS . 'documents'; $option = JRequest::getVar("option"); //Categories ============================================================================ if ($option == 'com_categories') { $documentpath = JPATH_ROOT . DS . 'images' . DS . 'documentscategories'; } plgfieldsattachment_file::deleteFile($file, $articleid, $fieldsid, $fieldsvalueid, $documentpath); if (!empty($_FILES[$file]['tmp_name'])) { //Create folder if not exist ---------------------------- if (!JFolder::create($documentpath . DS . $articleid)) { JError::raiseWarning(100, JTEXT::_("I haven't created:") . $documentpath . DS . $articleid); } else { //$app->enqueueMessage( JTEXT::_("Folder created:"). $documentpath .DS. $articleid) ; } plgfieldsattachment_file::uploadFile($file, $articleid, $fieldsid, $fieldsvalueid, $documentpath); } }