We did a lot of improvements on our API regarding input file uploads. Previously you had to embed the file together with all your parameters in a single multipart/form-related POST request. Although such multipart requests are widely used, implementing them is often pretty inconvenient. Therefore we decided to provide an alternative way of uploading the input files. In short you can use now a simple PUT requests to a designated upload url and send the actual file content as body of your request. Checkout our updated API documentation for details.
Using a designated upload url has another advantage: If your input files are provided by your users, you can now let them upload their files directly to CloudConvert. This avoids the time consuming process of uploading the files to your server first and afterwards sending them to us. We have updated our PHP wrapper with an example on how to use this:
<?php
require __DIR__ . '/vendor/autoload.php';
use \CloudConvert\Api;
$api = new Api("your_api_key");
$process = $api->createProcess([
'inputformat' => 'png',
'outputformat' => 'jpg',
]);
$process->start([
'input' => 'upload',
'outputformat' => 'jpg',
'converteroptions' => [
'quality' => 75,
],
'callback' => 'http://_INSERT_PUBLIC_URL_TO_/callback.php'
]);
?>
<form action="<?=$process->upload->url?>" method="POST" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit">
</form>
Don't worry - as always, our API stays full backward compatible. If you are using the old method of uploading files, nothing needs to be changed. Our suggestion of using the new method only applies to new implementations.