Currently have an upload system using Lightning components, here's the code:

 <lightning:fileUpload name="additionalFile" label="Upload up to 4 additional photos to include in your campaign page gallery"
                                  variant="brand" multiple="false" accept="{!v.fileTypes}" recordId="{!v.CCampaign.Id}"
                                  onuploadfinished="{!c.handleAdditionalFile}" required="true" disabled="{!v.isReadOnly}" />

{!v.fileTypes} here is ['.jpg', '.jpeg', '.png']

and here's the code snippet for previewing these images:

<aura:iteration items="{!v.additionalFiles}" var="file">
                <lightning:layoutItem size="12" smallDeviceSize="6" mediumDeviceSize="3" largeDeviceSize="3" padding="around-small">
                    <lightning:fileCard fileId="{!file}"/>
                    <lightning:input type="text" aura:id="fileName" label="File name" value="{!file}" required="true" disabled="{!v.isReadOnly}" />

and this is the result:

enter image description here

When deleting an uploaded file the preview becomes "No Preview Available" however SF still thinks the file exists and the ID is still available.

Is there a way to remove this permanently so the logic will never render the "No Preview Available" thumbnail?

This is also currently the way the images are deleted and as a side question, can there be logic applied when clicking on "Delete"

enter image description here

  • Would you mind adding some code that we can look at. Also some more information about what you are trying to delete would be helpful. Is it content? Images contained in a rich text field? Are you using aura components or web components? As for your side question you can definitely have logic on delete but it isn't clear what object you are using so its hard to tell you where to put the logic. – joshii May 2 '19 at 17:50
  • @joshii Apologies I have attached the necessary code snippets – Jason Fung May 2 '19 at 19:43

Your Answer

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

Browse other questions tagged or ask your own question.