/** * 處理上傳檔案 */ public function do_upload() { $config['upload_path'] = $this->config->item("upload_path"); $config['allowed_types'] = $this->config->item("allowed_types"); $config['max_size'] = $this->config->item("max_size") * 1024; $config["max_filename"] = 0; $config['encrypt_name'] = TRUE; $this->load->library('upload', $config); if ($this->upload->do_upload('bitstream') === FALSE) { $message = $this->upload->display_errors("<p>", "</p>"); $this->_message($message); return false; } $upload_data = $this->upload->data(); //print_r($upload_data); //檢查內部是否有上傳成功 if (!is_file($upload_data["full_path"])) { //$this->_message("upload failed"); $upload_data = $this->_do_php_upload($upload_data); //return; } $internal_name = $upload_data['file_name']; $original_name = $upload_data['orig_name']; $bitstream = new Bitstream(); $bitstream->set_field("original_name", $original_name); $bitstream->set_field("internal_name", $internal_name); $bitstream->set_field("type", "uploaded"); // 設定parameters $i = 0; while (isset($_POST["params_" . $i])) { $key = "params_" . $i; $value = $_POST[$key]; $bitstream->set_parameters($i, $value); $i++; } $bitstream->update(); $bitstream_id = $bitstream->get_id(); //echo "[".$bitstream_id."]"; $this->puli_log->create_log($bitstream, "upload"); // 觸動轉檔工作 //$this->_start_convert_cli(); // 記錄完畢,header去wait return $this->wait($bitstream_id); }