Ugo Lfe
Ugo Lfe

Reputation: 767

Storing files in symfony 4

I'm facing a problem of cleanliness and safety.

I'm using VichUploaderBundle to upload files, so I have to configure where to store them.

uri_prefix: ???
upload_destination: '%kernel.project_dir%/???'

Which places would be both accessible and secure (not accessible via the url) ?

thanks for your advices,

Upvotes: 0

Views: 872

Answers (1)

Etshy
Etshy

Reputation: 880

You can store them literally everywhere you want, as soon as not in the public folder, I guess.

For example you create a /data folder and stores them all here.

You store the file's info with the local path and other info you want in a database. Then when you want to access them, you search the file with PHP and return the file content to display it to the browser (via a URL including the id of the file info in database).

Is that what you meant ?

Upvotes: 2

Related Questions