-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
File upload in browser - use PUT if possible #4380
Comments
Next advantage: Once we switch to a PUT-based approach, we can implement file chunking, too. This means that for all practical purposes (with the unfortunate exceptions of the infamous IE 8 and 9), we do not have to deal with stupid PHP upload limitations. This alone will save us quite some headaches in the future. |
No need for that, there isn't a restriction on the size of PUT uploads in the first place |
@icewind1991 good point. still, chunks could be useful for resuming big downloads. |
There is an in depth description at http://stackoverflow.com/questions/12005790/how-to-receive-a-file-via-http-put-with-php Don't know if we have to manually cut the headers from the body. Will take a look along with the client side changes. |
@butonic webdav/sabredav already uses PUT for file upload - here is the code: |
Will apps that require the whole file behave properly? Like encryption or versioning for example. |
From my understanding all file operations within ownCloud work on streams - if not we need to change this. @icewind1991 @schiesbn |
Also now we have auth via session maybe we can use the webdav interface to do uploading of files? |
Adding to technical debt. Would make very much sense. @MorrisJobke Does something similiar in his music app for reading files. |
I just use get because I don't need PUT nowadays, but we should enforce using our own APIs and the WebDAV is the most stable of them ;) |
this will be implemented once we move over to use webdav in the files apps #12353 |
I suggest we keep this ticket as a subticket of #12353. Implementing PUT is already a challenging task, especially in regards to cross-browser compatibility. So it makes sense to have this implemented in its own PR. |
Moving to Webdav for uploads is scheduled for 9.0, adjusting milestone. |
CC @cmonteroluque |
nod |
Hint: this is still open. Maybe we can have a look at this https://github.com/23/resumable.js which seems to allow for chunking |
The toughest part here is making file conflict detection work with our conflict dialog, for BOTH the webdav approach (using precondition + 412 status) AND also for the IE8 workaround that uses ajax/upload.php... I'll see if I can bring their behavior / responses as close as possible. |
"tough" as in: lots of refactoring and rearranging response formats. The file-upload.js is a bit messy 😄 |
WIP PR here #21237 |
I'll keep an eye on the tough part to educate myself on clean js code. Boy this has been a long time ago. And I still remember what the code looked like before ... ;) |
Interesting, the blueimp uploader would POST to this URL with the IE iframe fallback:
This means that in theory instead of keeping "ajax/upload.php" we could simply write a Sabre plugin that processes this POST and internally plugs with the PUT logic. 😄 |
Still needs a bit more work for the PR #21237, moving to 9.1 |
Estimation: 1 week |
Someone raised a ticket for PUT chunking. Since we didn't have a dedicated ticket, let's use this one #25181 |
Hmm, but when overwriting a file we are using POST on collection with "Add-Member" here https://tools.ietf.org/html/rfc5995#page-5 here https://github.com/owncloud/core/blob/master/apps/dav/lib/Connector/Sabre/FilesPlugin.php#L440. Drawback is that we still use POST and would suffer from limitations. Also this approach is not compatible with new chunking, so might still need a client-side only approach that looks like this:
|
Fix for autorename is here: #26078 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Our file upload javascript component is capable of using PUT for file upload
https://github.com/blueimp/jQuery-File-Upload/wiki/Options
Using PUT has some advantages over the existing POST:
The PHP code will be trigger as soon as the first few kbs arrived th server.
In contrary in case of POST the web server will first receive the whole file and trigger the PHP code after the upload has been finished.
Why is this a better approach:
From my understanding this is why WebDAV uses PUT for file upload as well.
@karlitschek @danimo @dragotin @icewind1991 @butonic @blizzz @schiesbn @bartv2 @bantu @ringmaster
I'm summoning you all because I'd like to know any impact on any component you are working on if you see any issues with this approach.
THX
The text was updated successfully, but these errors were encountered: