Is there any example of uploading media?

10 replies [Last post]
Joined: 07/10/2009
Points: 11

Hello,

I'm interested on using PHP Client over my KalturaCE server. In Wiki Kaltura pages there are a link to a startingphpuse, but it isn't working.

Is there any example of the complete process of uploading a media file using php client over KalturaCE server?

Thank you very much

Joined: 04/05/2009
Points: 354

Have a look at:

http://www.kaltura.com/api_v3/sample/add_media.php

On your Kaltura CE installation, look at the source code in the api_v3/sample folder.

Joined: 07/10/2009
Points: 11

Well,

The page api_v3/sample/add_media.php is an example of KCW and not of the API PHP Client. And I can't see the php source and so I can't re-use it.

I'm looking for the process for uploading media using the PHP API, I supose that it was something like:
- create configuration
- create session
- uploading media

But Ilove to see an php example with the functions and variables used.

Thank you very much

Joined: 04/05/2009
Points: 354

So you want to upload to Kaltura using ONLY the API (i.e. it will be done all via code - no user interaction)? My suggestion would be to generate a CSV file using PHP (that points to the file you want to upload that's accessible on the web), then use the BulkUpload API call. For further information see:

http://www.kaltura.com/api_v3/testmeDoc/index.php?service=bulkupload&act...

Why can't you see the PHP source? As explained, just look at the source code located in the api_v3/sample folder of your Kaltura CE installation.

Also, for general information on the API, have you had a look at:

http://www.kaltura.org/kaltura-api-apiv3-getting-started

Joined: 07/10/2009
Points: 11

Thank you,

I'm doing my first php script:

$config = new KalturaConfiguration(KALTURA_PARTNER_ID);
$client = new KalturaClient($config);
$ks = $client->session->start(KALTURA_PARTNER_WEB_SERVICE_SECRET, $partnerUserID, KalturaSessionType::ADMIN);
$result = $client->media->upload('video.avi');

I have a ks, but when I use "$client->media->upload" I get: "Missing KS. Session not established". Why?

Joined: 04/10/2010
Points: 1

I know this is an old post but in case anyone else googles this, it looks like you are missing the call to setKs:

$config = new KalturaConfiguration(KALTURA_PARTNER_ID);
$client = new KalturaClient($config);
$ks = $client->session->start(KALTURA_PARTNER_WEB_SERVICE_SECRET, $partnerUserID, KalturaSessionType::ADMIN);
$client->setKs($ks);
$result = $client->media->upload('video.avi');

Joined: 04/05/2009
Points: 354

Sorry - I completely forgot about the "upload" API call...

Are you using APIv2 or APIv3?

What's the result of $ks? Are you sure a session was created successfully?

Joined: 05/06/2009
Points: 29

hey veo

when you use the upload call it should return a filename, usually a random string of letters with an flv extension. This is called a "file upload token". if you call the addFromUploadedFile api function with this file upload token as an argument it should return an entryID and add the file to the server

Joined: 04/12/2010
Points: 1

Thanks- mikejpeters. Was having the same problem and your solution worked.

.
Joined: 04/16/2010
Points: 1

Hi All,

Is there any example to upload and addentry for kaltura server.

I am new in kaltura trying to upload media file. its not uploaded.

The code

require_once("kaltura_client.php");
$conf = new KalturaConfiguration(x, xxx);
$user = new KalturaSessionUser(2);
$cl = new KalturaClient($conf);
$secert = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$cl->start($user, $secert);

$entry = new KalturaEntry();
$rs = $cl->upload($user,'NGC.wma');
print_r($rs);

I can not get any response to proceed for Add entry on kaltura server.

Please help me.

Joined: 05/06/2009
Points: 29

@ndixit

$rs = $cl->upload($user,'NGC.wma');

should read:

$rs = $cl->media->upload($user,'NGC.wma');
then with the response call the addfromuploadedfile command