Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.54 KB | None | 0 0
  1. function addResource() {
  2.     $this->load->library("form_validation");
  3.  
  4.     $config['upload_path'] = "./resources/";
  5.     $config['allowed_types'] = "jpg|png|gif|ogg|avi";
  6.                
  7.     $this->load->library('upload',$config);
  8.                
  9.     $this->form_validation->set_rules("r_name","Name","required|max_length[32]");
  10.     $this->form_validation->set_rules("r_type","Type","required");
  11.                
  12.     if (!$this->upload->do_upload('resource') || !$this->form_validation->run()) {
  13.         $this->load->view('addresource');
  14.     }
  15.     else {
  16.         $this->doAddResource($this->upload->data());
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement