This blog explains how to resolve the “The attachment is not a valid file type” error while uploading a JavaScript file as a notes attachment in a Web File record.

Follow below steps to resolve this issue:
- Go to Settings –> Advanced settings

- Go to Administration.

- Open System Settings.

- Remove the js option and click OK.

After doing this you will be able to add js files.
Hope you find this helpful! 🙂