Laravel 5.4: how to delete a file stored in storage/app

后端 未结 8 1622
臣服心动
臣服心动 2020-12-30 00:22

I want to delete a file that is stored in storage/app/myfolder/file.jpg. I have tried the following codes but none of this works:

use File    
$file_path = u         


        
8条回答
  •  鱼传尺愫
    2020-12-30 01:00

    Use storage

    //demo 
    use Illuminate\Support\Facades\Storage;
    
    Storage::delete($filename);
    

    Another way,

    unlink(storage_path('app/folder/'.$filename));
    

提交回复
热议问题