I am trying to open a form which will take in a picture (from the camera) and than send it to my controller in laravel.
Does any body know why this is not working?
Form in laravel:
<div style="width: 0; height: 0; overflow: hidden;">
{{ Form::open(array('route' => 'upload_photo', 'files' => true)) }}
<input type="file" onchange="this.form.submit();" id="camera_input" name="camera_input" accept="image/*" capture="camera" />
</div>
<button class="btn btn-primary btn-lg normal-font" type="button" onclick="takePicture();">Take Picture And Upload</button>
{{ Form::close(); }}
Javascript which will simply just open the camera/file select on click:
function takePicture() {
document.getElementById("camera_input").click();
}
Laravel controller: All I am doing is this to try to see if the file gets put over here:
public function upload_photo() {
$file = Input::file('camera_input');
var_dump($file);
}
It is getting NULL printed out for $file though... Anyone know what I am doing wrong?