2017-02-11 14 views
0

私のアングルアプリでは、大きなMP4ビデオファイル(500MB〜1GB)を残りのAPIを使用してアップロードしたいと考えています。私はng-file-uploadを使用しようとしましたが、20Mbを超えるビデオでは動作しません。angularjsを使用して大きなmp4ビデオファイルをアップロード

どうすればこのようなタスクを達成できますか?

PS:それは、アップロードできる最大ファイル・サイズのサーバ制限があるかもしれないことに聞こえるの上に私のサーバー側は説明からPHP

答えて

0

を書かれている - これはかなり一般的であり、への道最大サイズの設定または変更はサーバーによって異なります。一例として、ここで最小値と最大ファイルサイズを示しAWS S3のストレージのためのいくつかの設定です:

var s3Policy = { 
     'expiration': expiration, 
     'conditions': [{ 
       'bucket': aws.bucket 
      }, 
      ['starts-with', '$key', path], 
      { 
       'acl': readType 
      }, 
      { 
       'success_action_status': '201' 
      }, 
      ['starts-with', '$Content-Type', request.type], 
      ['content-length-range', 2048, 124857600], //min and max 
     ] 
    }; 

あなただけのビデオのアップロードのためのいくつかの例アンギュラコードが必要な場合は、その後、以下のコードがどのようにの一例ですサーバーへのWebページ/アプリから動画をアップロードする - それがAngularJS 1:

// Controls video upload from web uses module and apraoch at: https://github.com/danialfarid/angular-file-upload 
app.controller('WebUploadCtrl',[ '$scope', '$upload','colabConfig', function($scope, $upload, colabConfig) { 
    console.log("WebUploadCtrl controller"); 
    $scope.progressPerCent = 0; 
    $scope.onFileSelect = function($files) { 
     console.log("file selected for upload..."); 
     //$files: an array of files selected, each file has name, size, and type. 
     for (var i = 0; i < $files.length; i++) { 
      var file = $files[i]; 
      $scope.upload = $upload.upload({ 
      url: yourConfig.yourBaseURL + "/web_video_upload", 
      method: 'POST', 
      //headers: {'header-key': 'header-value'}, 
      //withCredentials: true, 
      data: {myObj: $scope.myModelObj}, 
      file: file, 
      }).progress(function(evt) { 
       console.log("progress: " + (evt.position/evt.totalSize)*100); 
       //$scope.$apply(function() { 
        $scope.progressPerCent = (evt.position/evt.totalSize)*100; 
       //}); 
      }).success(function(data, status, headers, config) { 
      // file is uploaded successfully 
      console.log(data); 
      }).error(function() { 
      console.log("Error on web video upload"); 
      }); 
     } 
    } 
}]); 
0

あなたがWeb構成ファイル内のプロパティを大きくしてみてくださいすることができます

<security> 
     <requestFiltering> 
     <requestLimits maxAllowedContentLength="30000000" /> 
     </requestFiltering> 
    </security> 
関連する問題