イニシャルの開発の初心者私は特定のパラメータでサーブに画像をアップロードし、それをアップロードするポストメソッドを使用するアプリがあります。私の問題は、私はこのフォーラムhttp POSTを使用したAPIサービスへの画像のアップロードionic angular.js
https://forum.ionicframework.com/t/file-upload-using-http-post-multi-form-data/10454
に基づいて?イオンの角度http.post使用して画像をアップロードすることができ、これは
https://forum.ionicframework.com/t/image-upload-to-api-service-using-http-post/36481
その使用をお勧めしますコードバファイルの転送特定のパラメータでどのように使用できますか
私はこの
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title></title>
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->
<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="http://code.highcharts.com/adapters/standalone-framework.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="https://rawgit.com/pablojim/highcharts-ng/master/src/highcharts-ng.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="js/ng-cordova.min.js"></script>
<script src="cordova.js"></script>
<!-- your app's js -->
<script src="js/app.js"></script>
</head>
<body ng-app="starter" ng-controller="homeController">
<ion-pane>
<ion-nav-title>
<span>Upload Foto</span>
</ion-nav-title>
<ion-content class="padding">
<button class="button button-block button-dark" ng-click="selImages()">
Select Images
</button>
<button ng-show="images.length > 0" class="button button-block button-stable" ng-click="shareAll()">
Share All
</button>
<div class="list card" ng-repeat="img in images">
<div class="item item-image">
<img ng-src="{{img}}">
</div>
<div class="item tabs tabs-secondary tabs-icon-left">
<a class="tab-item assertive image-option" href="#" ng-click="removeImage(img)">
<i class="icon ion-trash-a assertive"></i> Remove
</a>
</div>
</div>
</ion-content>
</ion-pane>
</body>
</html>
私のコントローラのようにそのをやっていること
angular.module('starter', ['ionic','highcharts-ng','ngCordova'])
.run(function ($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if (window.StatusBar) {
StatusBar.styleDefault();
}
});
})
.controller('ImagePickerCtrl', function ($scope, $rootScope, $cordovaCamera,$cordovaFileTransfer) {
$scope.images = [];
$scope.selImages = function() {
$scope.upload = function() {
}
window.imagePicker.getPictures(
function (results) {
for (var i = 0; i < results.length; i++) {
console.log('Image URI: ' + results[i]);
$scope.images.push(results[i]);
}
if (!$scope.$$phase) {
$scope.$apply();
}
}, function (error) {
console.log('Error: ' + error);
}
);
};
$scope.removeImage = function (image) {
$scope.images = _.without($scope.images, image);
};
$scope.shareImage = function (image) {
window.plugins.socialsharing.share(null, null, image);
};
$scope.shareAll = function() {
var url = "fendypradana.com/alfalahkeu/Apifalah/upload_buktibayar/format/json";
window.plugins.socialsharing.share(null, null, $scope.images);
var options = {
fileKey: "avatar",
fileName: "image.png",
chunkedMode: false,
mimeType: "image/png"
};
$cordovaFileTransfer.upload(url, targetPath, options).then(function (result) {
console.log("SUCCESS: " + JSON.stringify(result.response));
}, function (err) {
console.log("ERROR: " + JSON.stringify(err));
}, function (progress) {
});
};
})
私は本当に役立つだろう2のparamaterのuser_id = 5とketerangan = seragam 任意の提案を含める必要があります。オプションの中