I'm trying to make a post request from my controller to the Box.com API. The request will upload a file to my Box.com account. The following code is on my view:
<form action="/accept" method="post" enctype="multipart/form-data">
{{ csrf_field() }}
<input type="file" name="filename">
<input type="text" name="parent_id" value="0">
<button type="submit">Submit</button>
</form>
In my controller, I'm not getting any clue of how can I send the post request to the box.com API which will send the form data with an authorization header. The Box.com API require the authorization header to accept the request.
However, in Laravel documentation they've a section where I found the following code:
return response($content)
->header('Content-Type', application/json)
->header('Authorization', 'Bearer XXXXXXXXXXXXXXXX');
I can set the authorization header using this however, how the form data would be send then?
Here's the Box.com API URL to accept the post request:
https://upload.box.com/api/2.0/files/content