function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nishant SharmaNishant Sharma 

How to upload large file in lightning component with locker service enabled?

I have used forcetk library, in lightning component for uploading file in SFDC and that works perfectly fine with large files (~25MB), with Locker Service disabled.

However, when LockerService is enabled, it just stop working.

On Technical note:
I have made few changes in forcetk library to make it work for normal operations, but file upload aka createBlob is still an issue. If I go little deep, problem with file upload is, Locker Service restricts XMLHttpRequest global reference and hence end up responding bad request. Not sure, if there is any secure way of making XMLHttpRequest for file upload.
I have also tried this this link:
http://webcache.googleusercontent.com/search?q=cache:yDEYXecmDHMJ:peterknolle.com/file-upload-lightning-component/+&cd=1&hl=en&ct=clnk&gl=in

But that just let me upload file with small size and take LOT of processing time (as it process blob and pass the binary file as base64string).

Now, to summarize, what is the best way/tool to upload file in lightning component with Locker Service Enabled.
NagendraNagendra (Salesforce Developers) 
Hi Nishant,

May I suggest you to please check with below link from stack exchange community with similar requirement.

http://salesforce.stackexchange.com/questions/138205/file-upload-in-lightning-component-with-lockerservice-on

Please let us know if this helps.

Mark it as solved if it's resolved.

Best Regards,
Nagendra.
sfdcMonkey.comsfdcMonkey.com
Here is the Working Updated Version of Custom Large File Upload In lightning Component :)
  http://www.sfdcmonkey.com/2017/09/25/file-upload-
lightning-component/

Thanks :)