如何以及在哪里使用ng-flow保存上传的文件?

Tom*_*uce 10 javascript php angularjs flow-js

首先,我使用ng-flow(angular.js框架上的html5文件上传扩展)

我的文件已上传,我在控制台中记录了该事件.但我不明白在哪里以及如何保存它们.

这是我的html代码,上传被调用.

<div flow-init flow-files-submitted="$flow.upload()">   
<div class="drop" flow-drop ng-class="dropClass">
    <span class="btn btn-default" flow-btn>Upload File</span>
    <span class="btn btn-default" flow-btn flow-directory ng-show="$flow.supportDirectory">Upload Folder</span>
    <b>OR</b>
    Drag And Drop your file here
</div>
Run Code Online (Sandbox Code Playgroud)

这是我的配置

app.config(['flowFactoryProvider', function (flowFactoryProvider) {
  flowFactoryProvider.defaults = {
    target: 'upload.php',
    permanentErrors: [404, 500, 501],
    maxChunkRetries: 1,
    chunkRetryInterval: 5000,
    simultaneousUploads: 4,
    singleFile: true
  };
  flowFactoryProvider.on('catchAll', function (event) {
    console.log('catchAll', arguments);
  });
  // Can be used with different implementations of Flow.js
  // flowFactoryProvider.factory = fustyFlowFactory;
}]);
Run Code Online (Sandbox Code Playgroud)

upload.php被称为,并$_GET充满了数据,

<script>alert('alert' + array(8) {
  ["flowChunkNumber"]=>
  string(1) "1"
  ["flowChunkSize"]=>
  string(7) "1048576"
  ["flowCurrentChunkSize"]=>
  string(6) "807855"
  ["flowTotalSize"]=>
  string(6) "807855"
  ["flowIdentifier"]=>
  string(11) "807855-3png"
  ["flowFilename"]=>
  string(5) "3.png"
  ["flowRelativePath"]=>
  string(5) "3.png"
  ["flowTotalChunks"]=>
  string(1) "1"
}
)</script>
Run Code Online (Sandbox Code Playgroud)

但是当我在这里时,我必须做些什么来保存我的文件?

我试图做move_uploaded_file()flowFilenameflowRelativePath,但没有追加.

我是js的新手.

谢谢.

cho*_*ovy 4

查看 upload.php 示例脚本:

https://github.com/flowjs/flow.js/blob/master/samples/Backend%20on%20PHP.md

// init the destination file (format <filename.ext>.part<#chunk>
// the file is stored in a temporary directory
$temp_dir = 'temp/'.$_POST['flowIdentifier'];
$dest_file = $temp_dir.'/'.$_POST['flowFilename'].'.part'.$_POST['flowChunkNumber'];
Run Code Online (Sandbox Code Playgroud)