Detect size during upload #169
Unanswered
SDGPeteBatin
asked this question in
Q&A
Replies: 1 comment 1 reply
-
I think you can throw an exception if the bytes total exceeded your limit. At this moment the package has no built in solution but PR should not be hard to do :) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there a way I can get retrieve the size of the upload in progress while it uploads. I'm not looking for the total finished size, just the size of the upload so far. So if it's 50% complete, retrieve what size that is?
I've found these methods,
getBytesStart() - returns the starting bytes for current request
getBytesEnd() - returns the ending bytes for current request
getBytesTotal() - returns the total bytes for the file
But I'm not entirely sure what the first 2 would return, I'm guessing the 3 is for when the upload has completed? Is getBytesEnd() what I'm looking for? Current request is a little ambiguous, is that the current chunk or the current file (if multiple files).
Reason for this, I want to set a maximum upload size but I don't want to waste processes uploading a file that will ultimately fail validation if it's too large. So if the max size is 100MB and at 50% it's already 120MB there's no point allowing the continuation of the upload and I'd like to terminate it.
Beta Was this translation helpful? Give feedback.
All reactions