It depends on how big the files can be, how many users you have, how much RAM you have.
If the file size is limited and is relatively small, if the number of users is relatively small so that the volume of files they upload simultaneously is essentially less than RAM available, then it is fine to use memory-only approach.
If the volume of files that are being uploaded simultaneously is comparable with RAM available or greater, then memory-only approach can lead to a lot of swapping and considerable response delays, and even to timeouts. Application performance can degrade essentially for all users, even for those who don't upload anything at the moment. Then file based approach can be better.
If you fully control the server, then file based approach is as secure as memory-only. Memory-only approach does not mean that all your data are really all the time stored in memory. If the operating system decides to swap a part of its memory to disk, your data will be written to the disk.