Get your own customer support community
 

Having problem with file upload using CURL in SlideShare API.

I am using SlideShare API version 2.0 and trying to upload a PPT file using "upload_slideshow" method. For file upload I am using CURL in PHP. "upload_slideshow" method returns "false" instead of "slideshow id". Don't know what going wrong.

Here is my code:

$key= "my_api_key";
$secret = "my_secret_key";
$user = "my_username";
$password = "my_password";
$title = "This is a test title";
$srcfile = "@path/to/file";

$ts=time();
$hash=sha1($secret.$ts);
$curl_apiurl = "http://www.slideshare.net/api/2/upload_slideshow"."?api_key=$key&ts=$ts&hash=$hash";

$post_params['username'] = urlencode($user);
$post_params['password'] = urlencode($password);
$post_params['slideshow_title'] = urlencode($title);
$post_params['slideshow_srcfile'] = $srcfile;

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $curl_apiurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_params);
$result = curl_exec($ch);
curl_close($ch);

Please help me.
 
sad I’m sad, frustrated, confused
Inappropriate?
1 person has this problem

User_default_medium