Does anyone have an idea about uploading a new version of a File in Lightning Component using the base lightning component lightning:fileUpload
?
I tried passing ContentDocumentId
into recordId
parameter, but it returns error on upload.
<lightning:fileUpload name="fileUploader"
label= "Demo Upload"
multiple="true"
recordId="{!v.recordId}" />
Best Answer
This cannot be done with the
lightning:fileUpload
component.I solved this problem with the lightning:openFiles event.
This way a user has a preview of the file and inside the previewer you can upload a new version, delete, download and so on:
Here is some code sample:
Markup
Controller