I’m trying to create a bulk import script using API2. The idea is that user will copy files to a temporary folder on the Razuna server and specify path to the Excel file where will be a list of all the files that need to be uploaded, and then, using upload API2 call bulk import everything to Razuna. The problem is that it looks like that upload API2 call works only with HTML web form, but I would like to upload files that are already in a temporary directory on server.
How can I accomplish this?
Here is my code:
$localFile = “D:/temp/file.jpg”;
$ch = curl_init("http://dam.eld.see:8080/razuna/raz1/dam/index.cfm"); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POST, true); curl_setopt( $ch, CURLOPT_POSTFIELDS, array( 'api_key' => "324934fake35DBD", 'fa' => "c.apiupload", 'destfolderid' => "D4B14C861fakeB6C96CD0D114F", 'filedata' => '@' . $localFile )); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $meta_upd_resp = curl_exec($ch); echo $meta_upd_resp; curl_close($ch);
I get this error: Upload failed There was no appropriate FILE found in the upload.