1
hochladen
Ich versuche, Bild mit angularjs hochzuladen.Wie Bild mit angularjs
HTML:
<input type="file" id="picture" name="picture"/>
<button class="btn btn-primary" ng-click="AddNew()" type="submit">Save</button>
Controller.js
$scope.AddNew=function(){
console.log(picture.files.item(0));
$scope.myobject.picture=picture[0];
$http({
url: 'http://localhost/mypro/resource',
method: "POST",
data: {'resource' : $scope.myobject },
headers: {'Content-Type': undefined },
transformRequest: angular.identity
})
.then(function(response) {
// success
},
function(response) { // optional
// failed
});
};
Laravel 5.2:
routes.php
Route::resource('resource','ResourceController');
Controller:
public function store(Request $request){
Log::info('request: '.print_r(Input::all(),true));
Log::info('request: '.print_r($request,true));
return array('success' => true);
}
Nur leere Array hier bekommen. Und in der Konsole bekomme ich 500 (Interner Serverfehler).
Bitte führen Sie mich, was ich falsch mache.
Vielen Dank.