问题描述
首先,我使用(HTML5上angular.js框架文件上传扩展)
First of all, I use ng-flow (html5 file upload extension on angular.js framework)
我的文件上传,我登录控制台的事件。
但我不明白的地方以及如何保存它们。
My files are uploaded, I log the event in console.But I don't understand where and how to save them.
下面是我的html code,上传被调用。
Here is my html code, upload is called.
<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>
下面是我的配置
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;
}]);
upload.php的
被调用,而 $ _ GET
充满了数据,
upload.php
is called, and $_GET
is full with data,
<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>
但是当我在这里我有什么做救我的文件?
but when I'm here what I have to do to save my files?
我试图做 move_uploaded_file()以
在 flowFilename
和 flowRelativePath
,但没有追加。
I tried to do move_uploaded_file()
on flowFilename
and flowRelativePath
but nothing append.
我在JS是新。
感谢您。
推荐答案
看upload.php的示例脚本:
Look at the upload.php example script:
// 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'];
这篇关于如何以及在哪里保存上传的文件与NG-流?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!