Skip to content

Support for resumable uploads #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 13 commits into from
Closed

Support for resumable uploads #51

wants to merge 13 commits into from

Conversation

nerg4l
Copy link

@nerg4l nerg4l commented Sep 8, 2018

This resolves #10

I welcome any recommendation about my code.

Rough version of rearranged library
Added handler for Resumable.js
Added handler for blueimp File Upload
Clean up handler factories
Added/edited phpDoc
FileCheckHandler supports ng-file-upload
Added support for simple-uploader
Should use getFullFilePath when possible
Updated readme
@pionl
Copy link
Owner

pionl commented Sep 11, 2018

What the state? Is it implemented?

@nerg4l
Copy link
Author

nerg4l commented Sep 11, 2018

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

@pionl
Copy link
Owner

pionl commented Sep 11, 2018

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
Copy link
Author

nerg4l commented Sep 11, 2018

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

# Conflicts:
#	src/Handler/AbstractHandler.php
#	src/Handler/HandlerFactory.php
#	src/Receiver/FileReceiver.php
#	src/Save/AbstractSave.php
#	src/Save/ParallelSave.php
Fix fake file creation in test
Added test for getting the right handler from specific factories.
Fixed factories accordingly.
Fixed ServiceProviderMockTest
@nerg4l
Copy link
Author

nerg4l commented Sep 12, 2018

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
Copy link

Hi! I'm very interested in this functionality.

Are there any news about this merge request?
Thanks!

@rluders
Copy link

rluders commented Jan 3, 2019

I'm also interested in this feature.

@mattogodoy
Copy link

@rluders I made a temporary solution that is working with no issues:
#10 (comment)

@nerg4l nerg4l closed this Sep 30, 2019
@pionl
Copy link
Owner

pionl commented Nov 5, 2019

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

@nerg4l
Copy link
Author

nerg4l commented Nov 5, 2019

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
Copy link
Owner

pionl commented Jun 21, 2020

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

What's your recommendation to resumable uploads with this package?
4 participants