S
S
superyashaaa2020-01-12 01:02:36
Programming
superyashaaa, 2020-01-12 01:02:36

Is it possible to retrieve the database and use it as a folder name on the server?

An explanation of why such dances with a tambourine. To confirm the shipment, the user must upload the scan or photo file to the server for storage. What is the whole trash, so that everything does not lie in a heap, I think to create a separate folder for each confirmation, but it is not clear whether it is possible to extract the account number from the database and name the file by it.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Anton Neverov, 2020-01-12
@TTATPuOT

Why is it impossible?
Create a confirmation in the database, get a number, create a folder and save the data inside.
Then, by the confirmation number, get the path to the necessary files.

N
noxplex, 2020-01-13
@noxplex

but it is not clear whether it is possible to extract the account number from the database and name the file by it.

If it's not clear, build a many-to-many relationship between the user and their confirmations.
Get something like this in the table: user key / or account number, path to the image file, image upload date, confirmation status.
Well, how exactly to organize the file system depends on many factors that are not indicated in the question, for the simplest case, just a specific file name template that will eliminate duplicates is suitable - $userId_ $verificationId_$verficationDate.jpg well, or take a hash from these variables.
It is possible to push a picture in BLOB in general.

V
Vladimir Korotenko, 2020-01-14
@firedragon

Each user has a primary key, this is either email or id or his account in AD.
It is on the basis of this information that you create folders. Important note these folders MUST NOT be visible to the webserver, only accessed via api.
further create that that type of the table of the description. Store
id in it - file identifier
userid
name - name
virification - verification status
created - creation date
The files themselves are located according to the pattern /var/appstorage/userdata/userid/id

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question