file delete in laravel

42

Storage::disk('public')->delete($media->filename); 
use File;

if (File::exists(public_path('uploads/csv/img.png'))) {
     File::delete(public_path('uploads/csv/img.png'));
 }
// Delete a single file
File::delete($filename);

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

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

//And don't forget to add at the top:
use Illuminate\Support\Facades\File; 
 $destinationPath = 'your_path';
 File::delete($destinationPath.'/your_file');

Comments

Submit
0 Comments