Skip to main content

Unlike Aura sites, LWR sites don't support the lightning-file-upload base component. While I don't mind rolling my own file upload component, with Apex you're limited to files around ~4.5 MB, otherwise you hit heap size errors. That's too low a limit if you have to accept (for example) scanned documents in a PDF format, which can get up to 15-20 MB.

 

There is a workaround involving the Ajax Toolkit in a Visualforce iframe if the user is authenticated, but it doesn't work in a Guest User context. 

 

I raised this same issue on StackExchange and got an interesting (if not very secure) solution from sfdcfox. Now I'm posting to the Trailhead Group to improve the odds that the product team will recommend a path forward.

 

Will lightning-file-upload be supported in LWR sites in the future, as it is today in Aura sites? Is there some undocumented way to create a new ContentVersion record with lightning/uiRecordApi in an LWC? Anything else I should know to help guide decision-making?

답변 47개
  1. 2024년 12월 10일 오후 6:21

    Hi @Hares Saade, you can work around this error by enabling the setting mentioned by @Fabien Taillon from inside General Settings under Salesforce Files. Additionally, starting Spring '25, this feature will be Generally Available, with this setting enabled by default. Hope this helps! 

0/9000