7

We have a Lightning file uploader, and some of the files could end up being quite large (probably up to 1.5MB of base-64 encoded data), but we also have a slow network, so users might assume that the process is hung when it's really not. Previously, in Visualforce, we used "onprogress" to show a dual progress bar setup like we used to see back in the old days of Microsoft Windows (file progress/total progress). I didn't see anything in the documentation regarding this, but I was wondering if anyone knows of a way to detect how far long the upload progress is on large payloads. The result payload is small, and the Apex Code called runs in milliseconds, it's just the upload that takes ages. I'd prefer a more accurate solution rather than guesstimating.

  • 4
    Have you tried the lightning:fileUpload component? It shows a progress bar and might do what you're looking for. – Adrian Larson Jul 27 '18 at 21:14
  • @AdrianLarson (a) The files are pre-processed before uploading; the file the user selects is not the file sent to the server, and (b) the files are going to S3, so while they currently (temporarily) stored as Attachment files, this may not always be true as the process evolves. – sfdcfox Jul 28 '18 at 5:18
1

We had a similar situation and considered splitting the file into batches. (We decided not to, since our files weren't too large after all.)

If you have n batches to be uploaded consecutively, you can divide a progress indicator into n parts, ignoring that the last part should be shorter. It's not accurate, but at least your users will have a sense of progress.

  • +1 for the idea, but this is what we already had in Visualforce; the payload limits of remoting forced us to upload the files in chunks and stitch them back together at the end. By moving to Lightning, we were able to take advantage of the larger payload + components, resulting in a savings of about 900 lines of code, and with improved error handling. That said, I'd have to redo major chunks of the design I have now just to facilitate this change, or remove the error handling. Lots of moving parts. – sfdcfox Jul 29 '18 at 5:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.