It is pretty simple. This will only work in ionic FW
you must first install the file transfer plugin. if not use this command:
cordova plugin add org.apache.cordova.file-transfer
suppose http://www.samplewebsite.com/upload . this is a hyperlink to your server.
example.controller("ExampleController", function($scope, $cordovaFileTransfer) {
$scope.upload = function() {
var options = {
fileKey: "avatar",
fileName: "filename.mp4",
chunkedMode: false,
mimeType: "video/mp4"
};
$cordovaFileTransfer.upload("http://www.samplewebsite.com/upload", "file:/storage/....mp4", options).then(function(result) {
console.log("SUCCESS: " + JSON.stringify(result.response));
}, function(err) {
console.log("ERROR: " + JSON.stringify(err));
}, function (progress) {
});
}
});
<button class="button" ng-click="upload()">video upload</button>
. .