protected function common(Transform_Upload_Abstract $worker) { try { $data = $worker->process_file(); $success = true; } catch (Error_Upload $e) { $data = array('error' => $this->translate_error($e)); $success = false; } $this->reply($data, $success); }
protected function test_file() { parent::test_file(); $md5 = md5_file($this->file); if ($id = Database::get_field('art_pack', 'id', 'title = ?', $this->title)) { throw new Error_Upload($id, Error_Upload::ALREADY_EXISTS); } $this->md5 = $md5; }
public function __construct($file, $name) { parent::__construct($file, $name); $this->info = getimagesize($this->file); }