I perform an ajax call to a laravel controller, but it seems not working. What can I do?
public function postSubmit($id) {//Gelen geornal id'si
header('Content-Type: application/json');
$uploaded = [];
$allowed = ['jpg', 'png'];
$succeeded = [];
$failed = [];
if(!empty($_FILES['dosya'])) {
// It seems not entering here.. I want to save file here.
}
When I write that in controller:
$allFiles = Input::all();
return $allFiles;
I get this in my console:
Object {ajax: "true", file: Array[1]}
How can I get my file in controller?
This is the script:
<script>
document.getElementById('submit-button').addEventListener('click', function(e) {
e.preventDefault();
var f = document.getElementById('file_input'),
app.uploader({
files: f,
processor: "{{ URL::route('category/post', array($category->id)) }}",
});
});
</script>
And I have getFormData and ajax function to get FormData and for a XMLHttpRequest.