Before any upload is submitted the upload is registered in a list of
known uploads; this is needed to retrieve the upload object at several
points of the upload process. When a chunked upload is submitted first a
directory to upload all the chunks is created and, once that is done,
the chunks are sent; in order to send a chunk the upload object needs to
be retrieved from the list of known uploads.
When all the active uploads were finished the list of known uploads was
cleared. However, an upload is not active until it actually starts
sending the data, so while waiting for the upload directory to be
created the upload is already in the list of known uploads yet not
active. Due to all this, if the active uploads finished while another
pending upload was waiting for the upload directory to be created that
pending upload would be removed from the list of known uploads too, and
once the directory was created and thus the chunks were sent a field of
a null upload object would be accessed thus causing a failure.
Instead of removing all the known uploads at once when the active
uploads finish now each upload is explicitly removed when it finishes.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
The jQuery File Upload plugin triggers the "stop" event once there are
no more files being uploaded (even if some of them were added when
another upload was already in progress). Therefore, the progress bar
should be hidden in the "fileuploadstop" callback.
In some cases the "stop" event is not triggered and thus the progress
bar is not hidden once no more files are being uploaded. This is caused
by a race condition and it will be fixed in another commit; except in
buggy cases like that one (that need to be fixed anyway) it is safe to
hide the progress bar in the "fileuploadstop" callback.
In any case, note that the callbacks in "fileuploaddone" may be called
after the "stop" event was triggered and handled when using chunked
uploads. In that case once all the chunks are uploaded the assembled
file is moved to its final destination, so its promise could be resolved
after the "stop" event was triggered. Therefore a different approach
would be needed to keep the progress bar visible until the chunked
upload is truly finished, but for the time being the current one is good
enough.
Before this commit the progress bar was being hidden when the first
upload finished, either successfully or with an error, no matter if
there were other files being uploaded too.
The progress bar was being explicitly hidden also when the upload was
cancelled. When an upload is cancelled all the single uploads are
aborted, which triggers a "fail" event for each of them. However, the
"stop" event is always triggered when no more files are being uploaded,
so it is triggered too once all the single uploads were aborted. As all
the single uploads are immediately aborted in a loop when the general
upload is cancelled it makes no difference to hide the progress bar when
the first single upload is aborted or when all the single uploads were
aborted, so the progress bar is no longer explicitly hidden in the
former case.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
In case of error, instead of a generic error message, an upload will
display whichever message is returned in the Sabre Exception, if
applicable.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit adds chunked uploads in the Web UI (for authenticated users,
but not for public uploads). To do that the server endpoint used by the
uploader is changed from WebDAV v1 to WebDAV v2. The chunking itself is
done automatically by the jQuery-File-Upload plugin when the
"maxChunkSize" parameter is set; in "fileuploadchunksend" the request is
adjusted to adapt the behaviour of the plugin to the one expected by
"uploads/" in WebDAV v2.
The chunk size to be used by the Web UI can be set in the
"max_chunk_size" parameter of the Files app configuration. By default it
is set to 10MiB.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
If the estimated upload time is bigger than 4 hours it shows the text
"Uploading..." because the time then doesn't give any good hint to the
user anyways.
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
The unit of `data.bitrate` is bit, but the argument unit of
`humanFileSize` function is byte, so it should be divided by 8.
Signed-off-by: Yaojin Qian <i@ume.ink>
The upload remaining time is always 'a few second' whatever a big or a
small file uploading.
This commit fixes it. The `new Date().getMilliseconds()` only return a
three digits number. When time arrived the next second, the millisecond
start from ZERO again. So `new Date().getTime()` is the righe choice.
And remaining time variables shoule be initialized when the file starts
uploading, otherwise the remaining time of a new upload will always be
'Infinity years' until you refresh the page.
Signed-off-by: Yaojin Qian <i@ume.ink>
added quit option in notif in app.js
added quit option in notif in file-upload.js
added quit option in notif in fileinfomodel.js
added quit option in notif in filelist.js
added quit option in notif in filelist.js
added quit option in notif in tagsplugin.js
added quit option in notif in statusmanager.js
added quit option in notif in external.js
added quit option in notif in versionstabview.js
added quit option in notif in notification.js
changes according to the latest review.
timeout removed since there is a button to close it
translation capability added
typo fixed
test files updated
small errors fixed
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Removes the need for POST to collection which would hit against upload
limits.
The client tries to auto rename the file by adding a suffix "(2)".
It tries to use the file list on the client side to guess a
suitable name. In case a file still cannot be uploaded and creates a
conflict, which can happen when the file was concurrently uploaded, the
logic will continue increasing the suffix.
The web UI now uses for PUT uploads which aren't restricted by PHP's
upload_max_filesize and post_max_size
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
- uses PUT method with jquery.fileupload for regular and public file
lists
- for IE and browsers that don't support it, use POST with iframe
transport
- implemented Sabre plugin to handle iframe transport and redirect the
embedded PUT request to the proper handler
- added RFC5995 POST to file collection with "add-member" property to
make it possible to auto-rename conflicting file names
- remove obsolete ajax/upload.php and obsolete ajax routes
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
issue:
* drag'n'drop a folder into the files app in Firefox
* the highlight stays there because Firefox doesn't trigger the drop event for folders
solution:
* behave like the drop event if the dragover event isn't fired for 100ms (only applied in Firefox)