Example #1
0
 /**
  * upload
  * 
  * Grabs info from upload page and begins upload
  * 
  * @return boolean
  */
 public function upload()
 {
     $allowedExts = $this->config->getByType('allowed_file_type');
     $maxFileSize = $this->config->getByType('max_file_size');
     if (isset($_FILES)) {
         $extension = pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
         if ($_FILES["file"]["error"] > 0 && $_FILES["file"]["size"] < $maxFileSize && in_array($extension, $allowedExts) && strpos($_FILES['file']['type'], 'video/')) {
             if (!file_exists("uploads/" . $_FILES["file"]["name"])) {
                 move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $_FILES["file"]["name"]);
                 $user = new user();
                 $user->getCurrentUser();
                 $this->create($user->id, $_FILES["file"]["name"], $_POST['filename'], series::getSeriesId($_POST['file_series']), $_POST['file_description']);
                 return true;
             }
         }
     }
     return false;
 }