Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!defined("BASEPATH")) die(":)");
- class content extends subcontroller
- {
- /**
- * code removed
- *
- */
- private function handle_upload()
- {
- $this->load->library("upload");
- $this->upload->initialize($this->config->file_upload);
- if (!$this->upload->do_upload())
- {
- throw new general_exception(
- $this->upload->get_error(0),
- http::status_bad_request);
- }
- else
- {
- $result = $this->upload->data();
- $filename =
- mb_substr(
- preg_replace(
- array_keys($this->config->tidy_url_pattern),
- array_values($this->config->tidy_url_pattern),
- strtolower($result["raw_name"])),
- 0, 64).
- "-".uniqid().
- strtolower($result["file_ext"]);
- $newpath = $this->get_file_path($filename);
- rename($result["full_path"], $newpath);
- return($filename);
- }
- }
- /**
- * code removed
- *
- */
- }
Add Comment
Please, Sign In to add comment