I’m attempting to create a process whereby users can post images from their phones to their account. I have a mobile app that handles this process. Looking at the Upload API, I cannot determine how to get the uploading process to work. My current method is to use PHP to get the file from the user (which is successful) and then pass it to the upload endpoint via Curl. My Curl looks like this:
$url = 'http://shareatalent.com/members/Justyn/upload';
$vars = array(
"description" => "got me a file!",
"title" => "here's the title!",
"media_author" => 1,
"files" => $the_file,
"context" => "activity",
"context_id" => 1,
"mode" => "file_upload",
"file_contents" => '@'.$the_file
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt( $ch, CURLOPT_POST, 1);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $vars);
$response = curl_exec( $ch );
curl_close($ch);
$response = curl_exec( $ch );
Am I approaching this the right way? I’m not getting the uploaded file via this method.
Thanks much!
Justyn