public function testCreateFile() { $curl = new CUrl(self::TEST_URL_95); $file = $curl->fileCreate(__FILE__); if (PHP_VERSION_ID >= 50500) { $this->assertSame(TRUE, $file instanceof \CURLFile); } else { $this->assertSame(TRUE, '@' . __FILE__ == $file); } }
/** * @todo check filesize ??? 2MB in documentation * @param string $filename * @return XMLResponse * @throws FioException */ private function send($filename) { $curl = new CUrl(self::REST_URL_WRITE); $curl->setOptions(array(CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_SSL_VERIFYHOST => 2, CURLOPT_RETURNTRANSFER => 1, CURLOPT_HEADER => 0, CURLOPT_POST => 1, CURLOPT_VERBOSE => 0, CURLOPT_TIMEOUT => 60, CURLOPT_HTTPHEADER => array('Content-Type: multipart/form-data; charset=utf-8;'), CURLOPT_POSTFIELDS => array('type' => $this->uploadExtension, 'token' => $this->token, 'lng' => $this->language, 'file' => $curl->fileCreate($filename)))); $this->availableAnotherRequest(); $xml = trim($curl->exec()); if (!$xml) { throw new FioException('FIO server is not responding.', 500); } return $this->response = new XMLResponse($xml); }