/**
  * @param string $filename
  * @param Video $container
  */
 static function processUploadedVideo($filename, $container)
 {
     $file = new File();
     $file->access_id = $container->access_id;
     $file->container_guid = $container->guid;
     $file_guid = $file->save();
     FileSystem::uploadFile($filename, $file_guid, array("mov", "mpeg4", "mp4", "avi", "wmv", "mpegps", "flv", "3gpp", "webm", "3gp", "3g2", "m4v", "m2v", "mkv"));
     return $file_guid;
 }
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
    exit;
}
include_once dirname(dirname(__FILE__)) . "/engine/start.php";
$key = getInput("key");
if ($key == SITESECRET) {
    $owner_guid = getInput("owner_guid");
    $container_guid = getInput("container_guid");
    $video = new Video();
    $video->video_type = "upload";
    // $video->title = $title;
    // $video->description = $description;
    $video->owner_guid = $owner_guid;
    $video->access_id = "public";
    $video->container_guid = $container_guid;
    $video->save();
    $file = new File();
    $file->access_id = "public";
    $file->container_guid = $video->guid;
    $file_guid = $file->save();
    FileSystem::uploadFile("video", $file_guid, array("mov", "mpeg4", "mp4", "avi", "wmv", "mpegps", "flv", "3gpp", "webm", "3gp", "3g2", "m4v", "m2v", "mkv"));
    $video->video_guid = $file_guid;
    $video->save();
    $video->createAvatar();
    $video->save();
} else {
    echo "bad key";
}
Exemplo n.º 3
0
function uploadFile($filename, $file_guid, $allowed_extensions = array("png", "jpg", "jpeg", "gif", "doc", "docx", "ods"))
{
    return FileSystem::uploadFile($filename, $file_guid, $allowed_extensions);
}