more or less working chunked uploads on /cloud now.
This commit is contained in:
parent
cc0d53e695
commit
0e8e0b48b3
@ -64,6 +64,8 @@ class File_upload extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
if($partial) {
|
if($partial) {
|
||||||
$x = save_chunk($channel,$matches[1],$matches[2],$matches[3]);
|
$x = save_chunk($channel,$matches[1],$matches[2],$matches[3]);
|
||||||
|
|
||||||
|
logger('save_chunk: ' . print_r($x,true));
|
||||||
if($x['partial']) {
|
if($x['partial']) {
|
||||||
header('Range: bytes=0-' . (($x['length']) ? $x['length'] - 1 : 0));
|
header('Range: bytes=0-' . (($x['length']) ? $x['length'] - 1 : 0));
|
||||||
json_return_and_die($result);
|
json_return_and_die($result);
|
||||||
|
@ -18,58 +18,46 @@ function UploadInit() {
|
|||||||
var submit = $("#upload-submit");
|
var submit = $("#upload-submit");
|
||||||
var count = 1;
|
var count = 1;
|
||||||
|
|
||||||
|
|
||||||
$('#invisible-cloud-file-upload').fileupload({
|
$('#invisible-cloud-file-upload').fileupload({
|
||||||
url: 'file_upload',
|
url: 'file_upload',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
dropZone: filedrag,
|
dropZone: filedrag,
|
||||||
formData: $('#ajax-upload-files').serializeArray(),
|
formData: $('#ajax-upload-files').serializeArray(),
|
||||||
maxChunkSize: 100000, // 4 * 1024 * 1024,
|
maxChunkSize: 4 * 1024 * 1024,
|
||||||
|
|
||||||
add: function(e,data) {
|
add: function(e,data) {
|
||||||
$(data.files).each( function() { this.count = ++ count; prepareHtml(this) });
|
$(data.files).each( function() { this.count = ++ count; prepareHtml(this); });
|
||||||
|
|
||||||
data.submit();
|
data.submit();
|
||||||
},
|
},
|
||||||
|
|
||||||
// submit: function(e,data) {
|
|
||||||
// e.preventDefault();
|
|
||||||
// },
|
|
||||||
|
|
||||||
// done: function(e,data) {
|
progress: function(e,data) {
|
||||||
// addeditortext(data.result.message);
|
|
||||||
// $('#jot-media').val($('#jot-media').val() + data.result.message);
|
// there will only be one file, the one we are looking for
|
||||||
// },
|
|
||||||
// stop: function(e,data) {
|
$(data.files).each( function() {
|
||||||
// preview_post();
|
var idx = this.count;
|
||||||
// $('#profile-rotator').hide();
|
|
||||||
// },
|
// Dynamically update the percentage complete displayed in the file upload list
|
||||||
|
$('#upload-progress-' + idx).html(Math.round(data.loaded / data.total * 100) + '%');
|
||||||
|
$('#upload-progress-bar-' + idx).css('background-size', Math.round(data.loaded / data.total * 100) + '%');
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
stop: function(e,data) {
|
||||||
|
window.location.href = window.location.href;
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#upload-submit').click(function(event) { event.preventDefault(); $('#invisible-cloud-file-upload').trigger('click'); return false;});
|
$('#upload-submit').click(function(event) { event.preventDefault(); $('#invisible-cloud-file-upload').trigger('click'); return false;});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// is XHR2 available?
|
|
||||||
// var xhr = new XMLHttpRequest();
|
|
||||||
// if (xhr.upload) {
|
|
||||||
|
|
||||||
// file select
|
|
||||||
// fileselect.attr("multiple", 'multiple');
|
|
||||||
// fileselect.on("change", UploadFileSelectHandler);
|
|
||||||
|
|
||||||
// file submit
|
|
||||||
// submit.on("click", fileselect, UploadFileSelectHandler);
|
|
||||||
|
|
||||||
// file drop
|
|
||||||
// filedrag.on("dragover", DragDropUploadFileHover);
|
|
||||||
// filedrag.on("dragleave", DragDropUploadFileHover);
|
|
||||||
// filedrag.on("drop", DragDropUploadFileSelectHandler);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// window.filesToUpload = 0;
|
|
||||||
// window.fileUploadsCompleted = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// file drag hover
|
// file drag hover
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="files-upload-tools" class="section-content-tools-wrapper">
|
<div id="files-upload-tools" class="section-content-tools-wrapper">
|
||||||
{{if $quota.limit || $quota.used}}<div class="{{if $quota.warning}}section-content-danger-wrapper{{else}}section-content-info-wrapper{{/if}}">{{if $quota.warning}}<strong>{{$quota.warning}} </strong>{{/if}}{{if $quota.desc}}{{$quota.desc}}<br><br>{{/if}}{{$info}}</div>{{/if}}
|
{{if $quota.limit || $quota.used}}<div class="{{if $quota.warning}}section-content-danger-wrapper{{else}}section-content-info-wrapper{{/if}}">{{if $quota.warning}}<strong>{{$quota.warning}} </strong>{{/if}}{{if $quota.desc}}{{$quota.desc}}<br><br>{{/if}}{{$info}}</div>{{/if}}
|
||||||
<form id="ajax-upload-files" method="post" action="file_upload" enctype="multipart/form-data" class="acl-form" data-form_id="ajax-upload-files" data-allow_cid='{{$allow_cid}}' data-allow_gid='{{$allow_gid}}' data-deny_cid='{{$deny_cid}}' data-deny_gid='{{$deny_gid}}'>
|
<form id="ajax-upload-files" method="post" action="#" enctype="multipart/form-data" class="acl-form" data-form_id="ajax-upload-files" data-allow_cid='{{$allow_cid}}' data-allow_gid='{{$allow_gid}}' data-deny_cid='{{$deny_cid}}' data-deny_gid='{{$deny_gid}}'>
|
||||||
<input type="hidden" name="directory" value="{{$path}}" />
|
<input type="hidden" name="directory" value="{{$path}}" />
|
||||||
<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}}" />
|
||||||
|
Reference in New Issue
Block a user