I want to use Composer's PHP wrapper to upload an image to CloudConvert. This image will come from a html form which users will fill. In the array that CloudConvert's start() function uses to upload a file, the key/value pair for an image file is:
<?php
$process->start([
"input" => "download",
"file" => "http://url/to/my/file.ext",
"outputformat" => "png",
......
......
],
]);
?>
The value associated with the 'file' key seems as if it must be a public URL. Ideally I would like to use the html form variable as the value for the 'file' key in the array. I've tried using the $_FILES array with both ['tmp_name] and ['name'] but both throw errors. I've also placed an image in the root directory and then used $img_filepath = fopen('./Post_box_Lake_District.jpg', 'r');
but that throws the following error: Uncaught CloudConvert\Exceptions\ApiException: Upload is not allowed in this process state in C:\xampp\htdocs\test_site\vendor\cloudconvert\cloudconvert-php\src\Process.php:80.
I presume I could use the URLs for images stored on a file on my server but for the moment I'm storing images in a database. CloudConvert have a facility where users can upload their API but, if possible, I don't want to do that. I want everything to come through my server. So how can I upload images via CloudConvert's API. Thanks for any help in advance.