Nov 5, 2016
0
Level 1
How to get json file object and upload it in laravel
I want to upload an json file object in laravel , this object come from angular js with the below format:
{
"key": "lfobj2399fe3b",
"lfFile": {},
"lfFileName": "photo-1433354359170-23a4ae7338c6.jpg",
"lfDataUrl": "blob:http://localhost/14044b8b-9dcb-4461-8e2e-cf5337611396",
"element": {
"0": {
"ng339": 198
},
"length": 1
}
}
This is the plugin i've used to implement file upload in angular js : https://github.com/shuyu/angular-material-fileinput
I've tried :
if ($request->hasFile('banners')) {
return \Response::json('file available',$statusCode);
}
to check if any file is available in my input but i got nothing. if i want to get this object as an object i get it's value by using :
$banners = $request->input('banners');
but i can't upload any file with this input. how can i get this object and upload it in laravel ?
Please or to participate in this conversation.