示例#1
0
 static function video($database, $plugins, $settings, $path, $albumID = 0, $description = '', $tags = '')
 {
     $size = filesize($path);
     $video = new Video($database, $plugins, $settings, null);
     $nameFile = array(array());
     $nameFile[0]['name'] = $path;
     $nameFile[0]['type'] = Video::getMimeType($path);
     $nameFile[0]['tmp_name'] = $path;
     $nameFile[0]['error'] = 0;
     $nameFile[0]['size'] = $size;
     if (!$video->add($nameFile, $albumID, $description, $tags)) {
         return false;
     }
     return true;
 }
示例#2
0
 private function uploadVideo()
 {
     Module::dependencies(isset($_FILES, $_POST['albumID'], $_POST['tags']));
     $video = new Video($this->database, $this->plugins, $this->settings, null);
     echo $video->add($_FILES, $_POST['albumID'], '', $_POST['tags']);
 }
     if ($videoFileType != 'mp4') {
         $msg .= " Video is not an MP4 file. Please upload .mp4 files only.";
         $uploadOk = 0;
     }
     if ($uploadOk == 0) {
         $msg = "Sorry, your video was not uploaded. ERROR: " . $msg;
         $json = array("status" => 0, "msg" => $msg);
         $dbObj->close();
         //Close Database Connection
         header('Content-type: application/json');
         echo json_encode($json);
     } else {
         if (move_uploaded_file($_FILES["video"]["tmp_name"], $targetVideo)) {
             $msg .= "The file " . basename($_FILES["video"]["name"]) . " has been uploaded.";
             $status = 'ok';
             echo $videoObj->add();
         } else {
             $msg = " Sorry, there was an error uploading your video. ERROR: " . $msg;
             $json = array("status" => 0, "msg" => $msg);
             $dbObj->close();
             //Close Database Connection
             header('Content-type: application/json');
             echo json_encode($json);
         }
     }
 } else {
     $json = array("status" => 0, "msg" => $errorArr);
     $dbObj->close();
     //Close Database Connection
     header('Content-type: application/json');
     echo json_encode($json);