Laravel delete files from Public Folder

24 Nov 2018 . Laravel . 5K views

If you want to delete a file from public folder in Laravel, surely you can use PHP's unlink() method to remove that.

Besides unlink(), you can remove file by laravel way, by using the File::delete() method instead.

// Delete a single file

// Delete multiple files
File::delete($file1, $file2, $file3);

// Delete an array of files
$files = array($file1, $file2);

Hope it will work fine. Thank you.