NakedCat
NakedCat

Reputation: 860

Where to put my .txt files for PHP to read them in Laravel

I am creating a small application that is going to read .txt files and put each row of text in the database. I am not sure where to put those .txt files so that it's in accordance with Laravel standards. Should I put those files in the /public/ directory and access them from a controller via public_path() helper function?

The documentation seems to omit that information. I'd appreciate any help.

Upvotes: 2

Views: 2194

Answers (1)

Abdulla Nilam
Abdulla Nilam

Reputation: 38670

When using the local driver, note that all file operations are relative to the root directory defined in your configuration file. By default, this value is set to the storage/app directory. Therefore, the following method would store a file in storage/app/file.txt

Laravel Configuration

Upvotes: 4

Related Questions