So I'm working on a script that's going to upload a video to a server via a RESTful interface. The documentation tells me that I should pass the data (including the binary video file) as part of a POST request. I know how to set my POST variables, but I'm not sure how to do the binary data. The API says I should have a field called 'media' and it should contain the raw video data.
So let's say I have a video called 'video1.mp4' and I want to include its contents in my 'media' POST variable. How can I do this?
Thanks!
I don't know how you're communication with the API, but I'll assume cURL for this example. To send files, you use the
CURLOPT_POSTFIELDS
option:With an example further down on the page: