id = (int)safe_get("id"); if (isset($_POST["submit"])) { $this->filename = safe_post("filename"); $this->tmp_name = $_FILES["file"]["tmp_name"]; } } public function output() { echo "
"; if ($this->error !== "") echo html::wrap_div("bt_error", $this->error) . "
"; echo "
" . loc("ext_upload_file") . "
" . html::file("file") . "

" . loc("ext_upload_filename") . "
" . html::text("filename") . "

" . html::submit(loc("ext_upload_submit")) . "
"; } public function go() { try { wiki::upload($this->filename, $this->tmp_name); if ($this->id != 0) header("Location: ext.html?id=" . $this->id); else header("Location: index.html"); return true; } catch(wiki_bad_filename $e) { $this->error = loc("ext_upload_bad_filename"); } catch(wiki_failed $e) { $this->error = loc("ext_upload_failed"); } return false; } } $u = new uploader(); if (isset($_POST["submit"])) { if ($u->go()) exit; } output_head("extensions", "baretorrent - extensions"); ?>
output(); ?>