0

ファイルエクステントのサイズがここでどのように達成できるかが私のコードである場合、サービスからコントローラーにデータを送り返したいです。

myApp.service('fileUpload', ['$http', function ($http) {
this.uploadFileToUrl = function (fileData, uploadUrl) {
   if (fileData.size > 50000000) {
        var fd = new FormData();
        fd.append('file', fileData);
        $http.post(uploadUrl, fd, {
            transformRequest: angular.identity,
            headers: { 'Content-Type': undefined }
        })
        .success(function () {

        })
        .error(function () {

        });
    }
    else {
       return "Image size is more than 5MB";
    }
   }
  }]);
4

1 に答える 1