[POST] http://api.ankoder.com/files/upload
You can embed an upload form and let your users directly upload directly to our server. We will transcode the video and send it to your storage server, hence the upload process is transparent to your users.
Sample HTML upload Form
<form action="http://api.ankoder.com/files/upload"
method="post" enctype="multipart/form-data" >
<input name="access_key" type="hidden" value="89e3748d7a4cf2912347ff5422497d198657ec277" />
<input name="success_redirect" type="hidden" value="http://www.myapp.com/videos/upload/success" />
<input name="failed_redirect" type="hidden" value="http://www.myapp.com/video/upload/failed" />
<p>
<label for="file">File:</label>
<input id="file" name="file" type="file" /> (Max 2GB)
</p>
<input name="commit" type="submit" value="Submit" />
</form>
Parameters
| Required | Name | Description |
|---|---|---|
| required | file | Video file field |
| required | access_key | Your access key |
| success_redirect | The url that will redirect after user successfully upload | |
| failed_redirect | The url that will redirect after user failed upload (optional) | |
| custom_* | you can add fields start with ‘custom_’, we will post these fields back to your server by “Notification URL” |
Notification Message
When your user has uploaded a video to our servers, our system will POST a notification message to your application with the details supplied, since the file is never uploaded to your server.
| result | “success” or “failed” |
|---|---|
| error | empty or error message |
| type | NewVideo |
| video_id | ID of uploaded video |
| custom_fields | serialize of your custom_* fields |
Success Message Example
message={
"result": "success",
"error": null,
"video_id": 173,
"type": "NewVideo",
"custom_fields": {"custom_user": "1", "custom_profile": "5"},
"duration":"11540",
"size":"876986",
"filename": "lake.avi"}
&signature="rjTlkI06P2M5WF60rFBdbPQOjY8="
Failure Message Example
message={
"result": "failed",
"error": "invalid video",
"video_id": 61,
"type": "NewVideo",
"custom_fields": {"custom_user": "1", "custom_profile": "2"},
"video_name": "c11e2aac937c49aa669b7781b2322213b64485a4.mp4"}
&signature=6LHNLTHUQpDGeVYltTdpfNJVADo=
