4
4
4sadly2020-06-05 19:52:36
Laravel
4sadly, 2020-06-05 19:52:36

What is the best way to store files?

I use eloquent orm, I want to store files and access them by link, files must belong to users and transactions, how best to make a table and store these files? in 90% of cases they are images

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arseny, 2020-06-05
@4sadly

Model (table in the database) for the file manager, which contains all the necessary information:
1. File location directory.
2. Date (the file itself also has it, but sorting with looking into the directory is hard)
3. Format.
4. User (one-to-one is fine).
You can get it by ID (PK in the database), it's cheap and fast in terms of resources. And you can use a thread hash or random. At the same time, if you need files by specific names to be caught in the face, then start this field as an identifier and catch it by link. This method will allow you to distribute images to users as they will pass through the route.
In general, there is nothing like that in the output simply indicating a link to the file itself in its directory accessible to everyone, say the Assets / folder.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question