How to check for restricted file while uploading in react

705 views Asked by At

if a person renames the file extension to an allowed one let say abc.exe to abc.pdf and try to upload it.

I want to know if there are any open source library available in React/JavaScript to detect the content in the file so that no executable or malicious code is checked in even if the extension of the file is changed to what is allowed in the code

1

There are 1 answers

2
sai manoj On

You can follow the Answer given in this link Check if file is corrupted with node.js

If you are checking the uploaded file is pdf or not. Is that you want or do you want to check any file of any extensions is correct or not.

You use this npm module for checking pdf or not. https://www.npmjs.com/package/pdf2json