Not recommended.
The deployment folder is not stable. It can be wiped or replaced during redeployment, so your files can be lost. It also doesn’t work reliably in cloud environments.
Even if you do it with Java locally, it’s not a safe design.
Use System.FileDocument or external storage. I’d recommend AWS S3 for this.
If this resolves your issue, you can mark it as accepted.