Discussions

Ask a Question
Back to All

Create an application with documents in PHP

Good day all,
currently I still have a test account for testing. I would like to send applications with attached documents via a separate form. Saving the application by itself works quite well, but in the context of files I do not get further.

The access information is saved here:
$personioCompanyID = $e->config->personioCompanyID;
$personioToken = $e->config->personioToken;

All info of the form is here
$data = $e->arguments(1);

The file can be found here:
$documentPath = $data['file'][0];
$fileName = basename($documentPath);

With this request I can save the application, that works:

$response = $client->post('https://api.personio.de/v1/recruiting/applications', [ 'headers' => [ 'X-Company-ID' => $personioCompanyID, 'accept' => 'application/json', 'authorization' => 'Bearer '.$personioToken.'' 'content-type' => 'application/json', ], 'body' => json_encode($data, true) ]);

Can someone maybe help me out on how to accomplish uploading the file (it can be more than one)?

Thanks in advance