I have an attachment button that works fine. Now I want to cancel button which cancels the uploaded file. For this, I need to re-render the div by clicking the cancel button. How ?.IS there is better solution.
<template>
<lightning-card title="File Upload LWC" icon-name="custom:custom14">
<div class="slds-m-left_xx-large"> /* ----> this DIV */
<label style="display: inline-block;position: relative;height: 50px;width: 150px;" for="inputFile">
<div style="position: absolute;left: 0;top: 0;bottom: 0;
width: 100%;display: flex;border-radius: 10px;
align-items: center;justify-content: center;background: rgb(214, 211, 211);
border: 3px dotted #ffffff;">
<lightning-icon icon-name="utility:attach" alternative-text="attach!" title="attach" size="xx-small" ></lightning-icon> Attachment
</div>
<lightning-input type="file" style="position: absolute;left: 0;opacity: 0;top: 0;bottom: 0;width: 100%;"
accept=".xlsx, .xls, .csv, .png, .doc, .docx, .pdf"
label="Attachment tt" onchange={openfileUpload}></lightning-input>
</label>
</div>
{filename}
</lightning-card>
</template>