public function executeViewSuccess($render) { $fileManager = new Xcck_File($this->mObject); $path_file = $fileManager->getPath($this->_getName()); if (!file_exists($path_file)) { die("Error: File(" . $path_file . ") does not exist"); } if (!($fp = fopen($path_file, "r"))) { die("Error: Cannot open the file(" . $path_file . ")"); } fclose($fp); if (($content_length = filesize($path_file)) == 0) { die("Error: File size is 0.(" . $path_file . ")"); } header("Content-Disposition: inline; filename=\"" . $this->mObject->getShow($this->_getName()) . "\""); header("Content-Length: " . $content_length); header("Content-Type: application/octet-stream"); if (!readfile($path_file)) { die("Cannot read the file(" . $path_file . ")"); } die; //parent::executeViewSuccess($render); }
protected function _updateFile() { $fileManager = new Xcck_File($this->mObject); foreach ($this->mObject->mDef as $def) { if ($def->get('field_type') == Xcck_FieldType::FILE) { if ($this->mActionForm->get($def->get('field_name') . '_delete')) { unlink($fileManager->getPath($def->get('field_name'))); } move_uploaded_file($_FILES[$def->get('field_name') . '_file']["tmp_name"], $fileManager->getPath($def->get('field_name'))); } } }