We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Php curl cell not posting files

Here is my php code to uplaod a xlsx file and protect it.

Missing something which is not working. Can anyone help !

//$bearer_token => Authentication token
//$sourceFolder => Folder where file exists
//$fileName => abdc.xlsx

		$protectxlsx_url = "https://api.aspose.cloud/v3.0/cells/protect?password=123456";
		$protectxlsx_headers = array(
			"Content-Type: application/json",
			"Accept: application/json",
			"Authorization: Bearer ".$bearer_token."",
		);
		//var_dump(mime_content_type($sourceFolder.$fileName));  die;

		$tmp_file = curl_file_create($sourceFolder.$fileName);

		//$file_realpath = curl_file_create($fileSave);
		$protectxlsx_ch = curl_init();
		curl_setopt($protectxlsx_ch, CURLOPT_URL, $protectxlsx_url);
		curl_setopt($protectxlsx_ch, CURLOPT_POST, true);
		curl_setopt($protectxlsx_ch, CURLOPT_POSTFIELDS, $tmp_file);
		curl_setopt($protectxlsx_ch, CURLOPT_HTTPHEADER, $protectxlsx_headers);			
		$protectxlsx_apiresult = curl_exec($protectxlsx_ch);
		curl_close($protectxlsx_ch);
		$protectxlsx_apiresult_jsondecode = json_decode($protectxlsx_apiresult, true);

		//$protectxlsx_apiresult_jsondecode => not generating any data

This topic has been moved to the related forum: https://forum.aspose.cloud/t/php-curl-cell-not-posting-files/14625