Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
VP Factory API example code (upload button)
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
VP Factory  
View profile  
 More options Nov 4 2010, 4:30 pm
From: VP Factory <cont...@vpfactory.com>
Date: Thu, 4 Nov 2010 13:30:39 -0700 (PDT)
Local: Thurs, Nov 4 2010 4:30 pm
Subject: VP Factory API example code (upload button)
At the core of every video sharing website (such as Youtube, Vimeo
and
others) stands the functionality which enables users to upload their
own videos. An easy way to let the users upload their video content
is
to provide an upload button.

What does it do?
It lets you browse for a video on your computer and then uploads the
video into a test account. After the processing is over, the video
will appear in the player.

Below you can find the required PHP code.
<?php
require_once('../misc/api/apivpf.class.php');
$key = '4297f44b13955235245b2497399d7a93';
$api = new ApiVPF($key);
$upload_url = $api->baseURL() . 'addhostedvideo';
$player_txtid = '69421f032498c97020180038fddb8e24';
if (isset($_FILES['Filedata'])) {
        $file = $_FILES['Filedata']['tmp_name'];
        $data = array(
                'Filedata'=>"@$file",
                'key'=>$_REQUEST['key']
        );
        $ch = curl_init($upload_url);
        curl_setopt($ch, CURLOPT_POST      ,1);
        curl_setopt($ch, CURLOPT_POSTFIELDS    , $data);
        curl_setopt($ch, CURLOPT_HEADER      ,0);  // DO NOT RETURN
HTTP
HEADERS
        curl_setopt($ch, CURLOPT_RETURNTRANSFER  ,1);  // RETURN THE
CONTENTS
OF THE CALL
        $xml_video = curl_exec($ch);
        $myVideo = simplexml_load_string($xml_video);
        $video_mdid = $myVideo->mdid;
        header("Location: {$api->serverURL()}apidemo/upload.php?
referralVideo={$video_mdid}");

}

?>
Note:
We use cURL to send our data to the API server for processing and
expect a XML response which describes our newly uploaded video.
We then use this response in order to reload the player with the
uploaded content.
The HTML form necessary for the upload is described below:
<form id="file_form" enctype="multipart/form-data" action=""
method="post">
        <input type="hidden" name="MAX_FILE_SIZE" value="10485760" />
        <input type="hidden" name="key" value="<?php echo $api-

>getKey(); ?>"/

        Choose a file to upload: <input name="Filedata" type="file" /
><br />

        <input type="submit"  value="Upload File" />
</form>

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions Older topic »