Here is my Input mockup:
<input type="file"
name="headshot"
onchange="angular.element(this).scope().filesChanged(this)"
style="display: none"
change-headshot/>
The filesChanged()
function is
scope.filesChanged = function(elem)
{
scope.$apply(function()
{
$Cr.resource('photos').create(elem.files[0]);
}
}
The $Cr.resource()
is a custom service I have written that initiates all my resources from a config file. Upon selecting an image, I get a POST
call with the following request:
Accept application/json, text/plain, */*
Accept-Encoding gzip, deflate
Accept-Language en-US,en;q=0.5
Content-Length 391781
Content-Type multipart/form-data
And the 'post' item from the FireBug seems to be an image (since it says png followed by unreadable characters like squares and nonsense).
On my Laravel end though, I cannot get the image. I have $img = Input::file('headshot');
but this is empty and doesn't exist. I even var_dump(Input::all())
and it shows it as an empty list.
What am I doing wrong?