I have a functionality of uploading files. Before uploading, user can see "how many and which files they selected for upload", so user can see preview before uploading.
Whenver user selecting any file, I am converting selected files in base64
format.
Now lets suppose, I selected a PDF file, it will convert to base64
and that base64 I am using in href
of <a href={base64} target="_blank">{fileName}</a>
.
It will look like this:
Now, If I click on the link
. It will open a new tab for preview our PDF file. But I need to refresh the opened tab to preview pdf file. If don't refresh, it will show blank page. If I select open link in new tab
then I am able to see preview. But I don't know why it is not working when we click on the link.