more chunk work
This commit is contained in:
parent
df45c13f62
commit
76703dee84
@ -10,7 +10,8 @@ class File_upload extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
function post() {
|
function post() {
|
||||||
|
|
||||||
// logger('file upload: ' . print_r($_REQUEST,true));
|
logger('file upload: ' . print_r($_REQUEST,true));
|
||||||
|
logger('file upload: ' . print_r($_FILES,true));
|
||||||
|
|
||||||
$channel = (($_REQUEST['channick']) ? channelx_by_nick($_REQUEST['channick']) : null);
|
$channel = (($_REQUEST['channick']) ? channelx_by_nick($_REQUEST['channick']) : null);
|
||||||
|
|
||||||
@ -56,7 +57,7 @@ class File_upload extends \Zotlabs\Web\Controller {
|
|||||||
if(array_key_exists('HTTP_CONTENT_RANGE',$_SERVER)) {
|
if(array_key_exists('HTTP_CONTENT_RANGE',$_SERVER)) {
|
||||||
$pm = preg_match('/bytes (\d*)\-(\d*)\/(\d*)/',$_SERVER['HTTP_CONTENT_RANGE'],$matches);
|
$pm = preg_match('/bytes (\d*)\-(\d*)\/(\d*)/',$_SERVER['HTTP_CONTENT_RANGE'],$matches);
|
||||||
if($pm) {
|
if($pm) {
|
||||||
// logger('Content-Range: ' . print_r($matches,true));
|
logger('Content-Range: ' . print_r($matches,true));
|
||||||
$partial = true;
|
$partial = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2506,7 +2506,7 @@ function save_chunk($channel,$start,$end,$len) {
|
|||||||
}
|
}
|
||||||
if(($len - 1) == $end) {
|
if(($len - 1) == $end) {
|
||||||
unlink($tmp_path);
|
unlink($tmp_path);
|
||||||
$result['name'] = $_FILES['files']['tmp_name'];
|
$result['name'] = $_FILES['files']['name'];
|
||||||
$result['type'] = $_FILES['files']['type'];
|
$result['type'] = $_FILES['files']['type'];
|
||||||
$result['tmp_name'] = $new_path;
|
$result['tmp_name'] = $new_path;
|
||||||
$result['error'] = 0;
|
$result['error'] = 0;
|
||||||
|
@ -18,26 +18,28 @@ function UploadInit() {
|
|||||||
var submit = $("#upload-submit");
|
var submit = $("#upload-submit");
|
||||||
|
|
||||||
|
|
||||||
$('#invisible-cloud-file-upload').fileupload({
|
$('#files-upload').fileupload({
|
||||||
url: 'file_upload',
|
url: 'file_upload',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
// dropZone: $('#profile-jot-text'),
|
dropZone: filedrag,
|
||||||
maxChunkSize: 4 * 1024 * 1024,
|
maxChunkSize: 100000, // 4 * 1024 * 1024,
|
||||||
|
|
||||||
add: function(e,data) {
|
add: function(e,data) {
|
||||||
$('#profile-rotator').show();
|
$('#profile-rotator').show();
|
||||||
data.submit();
|
data.submit();
|
||||||
},
|
},
|
||||||
done: function(e,data) {
|
|
||||||
addeditortext(data.result.message);
|
// done: function(e,data) {
|
||||||
$('#jot-media').val($('#jot-media').val() + data.result.message);
|
// addeditortext(data.result.message);
|
||||||
},
|
// $('#jot-media').val($('#jot-media').val() + data.result.message);
|
||||||
stop: function(e,data) {
|
// },
|
||||||
preview_post();
|
// stop: function(e,data) {
|
||||||
$('#profile-rotator').hide();
|
// preview_post();
|
||||||
},
|
// $('#profile-rotator').hide();
|
||||||
|
// },
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#files-upload').click(function(event) { event.preventDefault(); $('#invisible-cloud-file-upload').trigger('click'); return false;});
|
// $('#files-upload').click(function(event) { event.preventDefault(); $('#invisible-cloud-file-upload').trigger('click'); return false;});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -185,6 +187,8 @@ function getIconFromType(type) {
|
|||||||
// upload files
|
// upload files
|
||||||
function UploadFile(file, idx) {
|
function UploadFile(file, idx) {
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
window.filesToUpload = window.filesToUpload + 1;
|
window.filesToUpload = window.filesToUpload + 1;
|
||||||
|
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
@ -229,15 +233,15 @@ function UploadFile(file, idx) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// POST to the entire cloud path
|
// POST to the entire cloud path
|
||||||
xhr.open('post', 'file_upload', true);
|
// xhr.open('post', 'file_upload', true);
|
||||||
|
|
||||||
var formfields = $("#ajax-upload-files").serializeArray();
|
// var formfields = $("#ajax-upload-files").serializeArray();
|
||||||
|
|
||||||
var data = new FormData();
|
// var data = new FormData();
|
||||||
$.each(formfields, function(i, field) {
|
// $.each(formfields, function(i, field) {
|
||||||
data.append(field.name, field.value);
|
// data.append(field.name, field.value);
|
||||||
});
|
// });
|
||||||
data.append('userfile', file);
|
// data.append('userfile', file);
|
||||||
|
|
||||||
xhr.send(data);
|
// xhr.send(data);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
<input type="hidden" name="channick" value="{{$channick}}" />
|
<input type="hidden" name="channick" value="{{$channick}}" />
|
||||||
<input type="hidden" name="return_url" value="{{$return_url}}" />
|
<input type="hidden" name="return_url" value="{{$return_url}}" />
|
||||||
<label for="files-upload">{{$upload_header}}</label>
|
<label for="files-upload">{{$upload_header}}</label>
|
||||||
<input class="form-group pull-left" id="files-upload" type="file" name="userfile">
|
<input class="form-group pull-left" id="files-upload" type="file" multiple name="files">
|
||||||
{{include file="field_checkbox.tpl" field=$notify}}
|
{{include file="field_checkbox.tpl" field=$notify}}
|
||||||
<div class="pull-right btn-group">
|
<div class="pull-right btn-group">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
|
Reference in New Issue
Block a user