I'm trying to upload a file to 3rd party endpoint, but I can't post the file directly from my form because the API requires an api_key which I can't expose to the end user. Therefore, my plan was to point the form to a controller/action and post the data from there. However, when I debug($this->request->data)
from inside the controller, the file data is missing.
The form on the view:
echo $this->Form->create('Media', array('type'=>"file", 'url'=>array('controller'=>'media', 'action'=>'upload') ) );
echo $this->Form->input('name', array("name"=>"name") );
echo $this->Form->input('file', array('type'=>'file', "name"=>"file") );
echo $this->Form->input('project_id', array('type'=>'hidden', "name"=>"project_id", "value"=>$project["Project"]['hashed_id']) );
//THIS CANNOT BE HERE: echo $this->Form->input('api_password', array('type'=>'hidden', "name"=>"api_password", "value"=>'xxxxxxx') );
echo $this->Form->end("Submit");
Here's what what I see when I debug()
the request data from the controller:
array(
'name' => 'Some Name',
'project_id' => 'dylh360omu',
)
What's going on here?