Open source media management and distribution platform
This is one of the possibilities to upload a still as a picture. The other is to call /mediafile/{mediafile_id}/uploadticket/create, and use the response->items->item->action URL with &still_upload=TRUE as action. Till version 1.7.
Drupal example:
$form['file'] = array('#type' => 'file', '#name' => 'file', '#title' => t('Your still'), '#required' => TRUE,);
$form['#attributes'] = array('enctype' => 'multipart/form-data');
$form['asset_id'] = array('#type' => 'hidden','#value' => $asset_id,);
$form['mediafile_id'] = array('#type' => 'hidden', '#value' => $mediafile_id,);
$form['redirect_uri'] = array('#type' => 'hidden', '#value' => url('mediafile/'. $mediafile_id, array('absolute' => TRUE)),);
$vpx = new vpx_connector();
$response = $vpx->request('GET', '/mediafile/'. $mediafile_id .'/uploadticket/create');
$action = (string)$response->items->item->action;
if (!$action) {
drupal_set_message(t('Internal error: Unable to create upload ticket. Please try again later.'), 'error');
}
$form['#action'] = $action .'&still_upload=TRUE';
/asset/{asset_id}/still/upload [POST]
|
Parameter |
Type |
Description |
Method |
Obligatory/Optional |
|
upload_ticket |
alphanumeric |
upload ticket, you can obtain it useing ticket REST call. |
POST |
obligatory |
|
mediafile_id |
alphanumeric |
mediafile_id |
POST |
obligatory |
|
redirect_uri |
uri |
An URI, where the user will be redirected after the upload. |
POST |
optional |
|
file |
file |
HTML FORM field of the 'file' type. |
POST |
obligatory, if it is not a POST |
|
order |
integer |
Still order number |
POST |
optional |
|
default |
string |
Is default? (TRUE, FALSE) |
POST |
optional |
/asset/B93Y4bJxLRof608OtHofiK9C/still/upload
POST:
upload_ticket=j89y492b84
order=2
default=TRUE
<form method="post" enctype="multipart/form-data" action="http://upload.vpx.kennisnet.nl/asset/B93Y4bJxLRof608OtHofiK9C/upload" />
<input type="file" name="file" />
<input type="hidden" name="upload_ticket" value="j89y492b84" />
<input type="hidden" name="redirect_uri" value="http://www.example.com" />
<input type="hidden" name="mediafile_id" value="SOGsCn8yIYAYlf9LAoP058pr" />
<input type="submit" value="Upload" />
</form>
|
Field |
Description |
|
n/a |
Standard header, if there weren't redirection. |