/** * Method that extracts contents of a file and upload * @param string $fileName * @param boolean $getFileContents * @return type * @throws Exception * @codeCoverageIgnore */ public static function uploadPublicFile($fileName, $getFileContents = true) { try { $sugarUploader = new UploadFile($fileName); if ($getFileContents) { return $sugarUploader->get_file_contents(); } else { $sugarUploader->confirm_upload(); $sugarUploader->final_move($fileName . '_' . create_guid()); return array(); } } catch (Exception $oException) { throw $oException; } }
/** * @codeCoverageIgnore */ public function getLogFile($file) { //$this->bpmLog('INFO', " getting log from " . $file); //return file_get_contents($file); require_once 'include/upload_file.php'; $_file = new UploadFile(); //get the file location $_file->temp_file_location = $file; //alternatively you can do the following if you know the upload file id //$file->temp_file_location = UploadFile::get_upload_path($file_id); return $_file->get_file_contents(); }
/** * Function to get a data for File uploaded * @param $file * @return mixed */ public function getDataFile($file) { //return file_get_contents($file); require_once 'include/upload_file.php'; $_file = new UploadFile(); //get the file location $_file->temp_file_location = $file; $_data = $_file->get_file_contents(); return $_data; }