I'm about to start work on a project and I'd like to know if I have my thinking straight. A user should be able to upload writing in the form of plain text, images, videos, or audio files. Then those files should be displayed to other users.
My trouble is there are different methods for displaying each of those. For instance, I can't say
<img src="writing.txt">
if the file isn't a picture.
What I was thinking was I would store both the file path (to some cloud storage bucket) and the file type in a row in the database. Then when a user wants to see a file, I'll check what kind of file it is and then render the web page using the appropriate display method.
Is that what people do?
Aucun commentaire:
Enregistrer un commentaire