resume doesn't work (CONTENT_LENGTH = 0)
I'm trying to use uploader with PHP for very big files with chunked upload (works OK) and resume option. I'm using your resume-code from the wiki (https://github.com/blueimp/jQuery-File-Upload/wiki/Chunked-file-uploads). it does not work (FF/Chrome).
I'm using only the data:function() part to manually start upload again.
- data.uploadedBytes will be set correct after the $.JSON request
- every following POST has $_SERVER['CONTENT_LENGTH'] => 0
so nothing is uploaded
it seems that the wiki-code is not up-to-date since there is a false reference to 'php/index.php' which should read 'server/php/index.php'
unfortunately I'm not skilled enough with javascript (prototype/ function argument this/that whoos) to fix that by myself, so help is appreciated.
cheers, robert
I've updated the urls on the chunked uploads documentation. However I've tested the resume and it worked as expected in my tests.
Please try to reproduce this issue with an unmodified download package and just setting 'discard_aborted_uploads' => false in upload.class.php as well as editing main.js and replacing
$('#fileupload').fileupload();
with
$('#fileupload').fileupload({
maxChunkSize: 10000000, // 10 MB
add: function (e, data) {
var that = this;
$.getJSON('server/php/index.php', {file: data.files[0].name}, function (file) {
data.uploadedBytes = file && file.size;
$.blueimpUI.fileupload.prototype
.options.add.call(that, e, data);
});
}
});
hey can you please help me on this https://github.com/blueimp/jQuery-File-Upload/issues/1076
YES! it works now. great. a week ago I downloaded a zip file, but now I did a fresh git clone and that works as expected. there are quite a few changes everywhere.
if you are interested I have some alternative functions, that make uploads > 2 GB work with php running on 32bit unix style machines. one must basicaly get rid of is_file(), filesize() and file_put_contents() plus make some numbers-are-strings-now casts.
function x_is_file($file){
$file = escapeshellarg($file);
exec("[ -f $file ]", $tmp, $ret);
return $ret == 0;
}
function x_filesize($file){
$file = escapeshellarg($file);
return (string) trim(`stat -c%s $file`);
}
function x_file_append($tofile, $appendstring){
$tofile = escapeshellarg($tofile);
$append = tempnam(sys_get_temp_dir(), 'append-chunk-');
file_put_contents($append, $appendstring);
`cat $append >> $tofile`;
unlink($append);
}
@vijendrapatil: I'm sorry I can't help you. I don't understand this widget/ui/callback stuff. all those promises.. I'm an old man. I hope I will get away with only the smallest changes.
Robbie-Wilhelm, if you like you can add a wiki page about your adjustments: https://github.com/blueimp/jQuery-File-Upload/wiki/_new