podio-community / podio-php

PHP Client for the Podio API.
https://podio-community.github.io/podio-php/
MIT License
153 stars 173 forks source link

File uploading is not working on php vrersion 7.2.20 #172

Open dilipsoni opened 5 years ago

dilipsoni commented 5 years ago

The file upload to Podio used to work on my website, but it has stopped working. I have updated PodioFile.php with the update, and it now works again on my localhost for testing but not on the webserver. Both are running PHP 7.2.20 . Screenshot_14

dilipsoni commented 5 years ago

Here is my podio.php code if (!empty($options['upload'])) { curl_setopt(self::$ch, CURLOPT_POST, TRUE); if(!class_exists("\CURLFile") && defined('CURLOPT_SAFE_UPLOAD')) { curl_setopt(self::$ch, CURLOPT_SAFE_UPLOAD, FALSE); } curl_setopt(self::$ch, CURLOPT_POSTFIELDS, $attributes); self::$headers['Content-type'] = 'multipart/form-data'; }

and podioFile Code public static function upload($file_path, $file_name) {

$source = defined('PHP_MAJOR_VERSION') && PHP_MAJOR_VERSION >= 5 ? new CurlFile(realpath($file_path)) : '@'.realpath($file_path);
return self::member(Podio::post("/file/v2/", array('source' => new CurlFile(realpath($file_path)), 'filename' => $file_name), array('upload' => TRUE, 'filesize' => filesize($file_path))));

}