I'm trying to edit an excel file after uploading it in laravel. the file is uploaded to local disk, so no one can access it from the public.
Filesystems.php
'local' => [
'driver' => 'local',
'root' => storage_path('app')
Routes.php
Route::get('test',function()
{
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
$objPHPExcel = PHPExcel_IOFactory::load(Storage::disk('local')->url('margin/analyser/0IGkQQgmGXkHrV9ISnBTrGyZFUPfjz3cWJbLGbDN.xlsx'));
$objPHPExcel->setActiveSheetIndex(0);
echo $objPHPExcel->getActiveSheet()->getHighestRow();
})->middleware('admin');
I keep getting error:
Could not open /storage/margin/analyser/0IGkQQgmGXkHrV9ISnBTrGyZFUPfjz3cWJbLGbDN.xlsx for reading! File does not exist.
this works
$objPHPExcel = PHPExcel_IOFactory::load('..'.Storage::disk('local')->url('app/margin/analyser/0IGkQQgmGXkHrV9ISnBTrGyZFUPfjz3cWJbLGbDN.xlsx'));
but it is annoying. I thought specifying 'root' => storage_path('app') in the filesystems.php means that Storage::disk('local') will be in the app directly