pionl / laravel-chunk-upload

The basic implementation for chunk upload with multiple providers support like jQuery-file-upload, pupload, DropZone and resumable.js
MIT License
617 stars 167 forks source link

Support for resumable uploads #51

Closed nerg4l closed 5 years ago

nerg4l commented 6 years ago

This resolves #10

I welcome any recommendation about my code.

pionl commented 6 years ago

What the state? Is it implemented?

nerg4l commented 6 years ago

I did not have time yesterday to resolve the conflicts. Despite that it is finished.

pionl commented 6 years ago

ok, I can make resolve conflicts when I have free time. Is there any necessary js changes I need to make? (to test the feature)

nerg4l commented 6 years ago

23/resumable.js

Enable testChunks

You can find a detailed description about the property here.

The point is, it will send a GET request to the same url where it sends the POST.

blueimp/jQuery-File-Upload

$('#fileupload').fileupload({
    maxChunkSize: 10000000, // 10 MB
    add: function (e, data) {
        var that = this;
        var f = data.files[0];
        $.getJSON('server/php/', {file: f.name, size: f.size}, function (result) {
            data.uploadedBytes = result.size;
            $.blueimp.fileupload.prototype
                .options.add.call(that, e, data);
        });
    }
});

A simmilar example can be found here, the difference is you have pass the size of the file, because it is used by the handler to create a unique filename and also the size property is in the base response not under a file property.

simple-uploader/Uploader

This is really simmilar to 23/resumable.js as you can see here. And according to the documentation both treats 204 No content response the same way. Only the name of the parameters are changed.

danialfarid/ng-file-upload

It has a resumeSizeUrl property. You can find an example here.

Same thing applies here as on jQuery-File-Upload, which means you have to pass the size too, not just the filename.

resumeSizeUrl: '/uploaded/size/url?file=' + file.name + '&size=' + file.size
nerg4l commented 6 years ago

The way I implemented the HandlerFactory isn't the best. I'll think about a better way. If you have an idea or suggestion I would appreciate it.

mattogodoy commented 5 years ago

Hi! I'm very interested in this functionality.

Are there any news about this merge request? Thanks!

rluders commented 5 years ago

I'm also interested in this feature.

mattogodoy commented 5 years ago

@rluders I made a temporary solution that is working with no issues: https://github.com/pionl/laravel-chunk-upload/issues/10#issuecomment-448615836

pionl commented 5 years ago

Hi @nerg4l, should I find the time to check your feature? Did you finally use it in production?

nerg4l commented 5 years ago

This implementation is very hacky and I decided to ditch it. With the current logic of the request handling it is really hard to distinguish between the frontend libraries when the norm of this library is to rely on the parameters/headers.

I started working on a different implementation to make it simpler with using drivers. My current work is available here: https://github.com/LaraCrafts/laravel-chunk-uploader

pionl commented 4 years ago

I see you improved the ideas -- the separation between handle / saver is not ideal I would definitely used different approach now. It could get a rewrite but to late know :)