3

I'm Sending this Video Blob to the uploadVideo.php file how would i retrieve it on the uploadvideo.php page?

function postVideoToServer(videoblob) {
        var data = {};
        data.video = videoblob;
        data.metadata = 'test metadata';
        data.action = "upload_video";
        jQuery.post("http://mysite.com/uploadvideo.php", data, onUploadSuccess);
    }

More Details

function postVideoToServer(videoblob) {
    var data = {};
    data.video = videoblob;
    data.metadata = 'test metadata';
    data.action = "upload_video";
    jQuery.post("http://mysite.com/uploadvideo.php", data, onUploadSuccess);
}

And On the uploadvideo.php i have this:

    <?php
    require("connect.php");

    $video = $_POST["video"];
    $up = mysql_query("INSERT INTO video VALUES ('$video')");
    ?>

But it still does not seem to work? I Think i am doing something wrong?

Alexander Nazarkin
  • 261
  • 1
  • 4
  • 10

3 Answers3

2
$video = $_POST['video'];
$metadata = $_POST['metadata'];
$action = $_POST['action'];
Kautil
  • 1,321
  • 9
  • 13
1

You can use either $_REQUEST["key"]

$video = $_REQUEST["video"];
$metadata = $_REQUEST["metadata"]; //test metadata
$action = $_REQUEST["action"]; //upload_video

or $_POST["key"]

$video = $_POST["video"];
$metadata = $_POST["metadata"]; //test metadata
$action = $_POST["action"]; //upload_video

to retrieve the data sent to the PHP script.

To read a little bit more about different data retrieval techniques and their comparison in PHP refer link.

Community
  • 1
  • 1
Faisal Sayed
  • 783
  • 4
  • 12
  • I Put this into the uploadvideo.php but it does not seen to work maybe its the script for the getusermedia? require("connect.php"); $video = $_POST["video"]; $up = mysql_query("INSERT INTO video VALUES ('$video')"); – Alexander Nazarkin Jun 25 '13 at 10:59
0

uploadvideo.php:

$video = $_POST["video"];
$metadata = $_POST["metadata"]; //test metadata
$action = $_POST["action"]; //upload_video
...

now you can do whatever you want with these.

kajacx
  • 12,361
  • 5
  • 43
  • 70