Private catalog of temporary storage in Laravel

With Laravel, I assume the folder storage/

is a good place to unpack some temporary files. Therefore, in the code I mentioned this way: storage/tempdir

. As shown below:

$zip = new ZipArchive();
$zip->open($request->excelFile->path());
$dir = "storage/tempdir";
$zip->extractTo($dir);

      

But the unpacked files end in public/storage/tempdir/

So they are available to the public and I don't want that.

How can I link to storage/tempdir

on both my Windows and Linux machines? Tpi.

+3


source to share


1 answer


Use storage_path()

helper:



$zip->extractTo(storage_path('tempdir'));

      

+2


source







All Articles