Newbie is looking for some advice.
I am not doing a project on write a mail system with attach function. My colleagues is using a method to save the "content" of the attachment to database. For eg. When it is a txt file with "Hello", then "Hello" will be saved to DB.
Personally I go for only saving file path, file name to DB, and FTP the file to our server.
I would like to know which method is better. For method (1), when the file is jpeg with file size 400KB, then all content will be saved to DB. I worry the rapid expansion of DB size and what I see from DB is some meaningless code representing that jpeg. For method (2), I can only saved the path of where the file is stored, as well as the file name. But from security aspect, the file path will be disclosed to users when they click the link. Also it has the risk for other user to 'steal' file that is not belong to him.
Can anyone give me some advice? If I go out method (2). how can I improve the security.