let imgsrc = this.state.retrieveuploadfile.filecontent;
<Dialog
className=""
open={this.state.openattachmentDialog}
modal={false}
autoScrollBodyContent={true}
contentStyle={{ maxWidth: 'none' }}
onRequestClose={this._closeDialog} >
<div>
<img src={"data:image/jpeg;" + imageBase64} style={{maxWidth: '250px', margin: '15px'}}/>
<embed width="100%" height="100%" name="plugin" src={"data:application/pdf;" + imageBase64} />
</div>
</Dialog>
I have a dialog where i can list out all the attachments which are uploaded. After the successful upload of an image I am calling the Retrieve API for all uploaded images. I am receiving the response in the below format
If it is an image I need to show the image, if it's a PDF I need to show the PDF.if it's a Word I need to show the Word. Based on base64 we need to convert and show them in the UI.
You can see in the response in the filecontent
property the base64 code.
How can I show a word based on base64 ?