E
E
EVOSandru62020-07-01 00:49:57
Laravel
EVOSandru6, 2020-07-01 00:49:57

How in laravel to access a file from a controller through a path located in a folder?

The file /storage/private/1.jpeg (there is a symlink. In nginx I cut off viewing private)
(via a relative path ala ../ ) does not find

It turned out to be accessed only if I put it in public in this way:

$filename =  '1.jpeg';;
$handle = fopen($filename, "rb");
$contents = fread($handle, filesize($filename));
fclose($handle);
header("content-type: image/jpeg");
echo $contents;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2020-07-01
@EVOSandru6

https://laravel.com/docs/7.x/filesystem#downloadin... well, and neighboring sections.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question