Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to delete image from floder in laravel

//suppose you have an image inside public/images folder 
$image_path = "/images/filename.ext";  // Value is not URL but directory file path
if(File::exists($image_path)) {
    File::delete($image_path);
}
//don't forget to add "use IlluminateSupportFacadesFile;"
Comment

Delete an image laravel

//On top
use IlluminateSupportFacadesStorage;

//then
if(Storage::exists('your/path'.$file_name)){
  Storage::delete('your/path'.$file_name);
  /*
    Delete Multiple File like this way
    Storage::delete(['path/example.png', 'path/example2.png']);
  */
  return true;
}
Comment

PREVIOUS NEXT
Code Example
Php :: php code to check if variable is null 
Php :: php artian migrate table 
Php :: laravel check old password 
Php :: get country from ip php 
Php :: run artisan command from controller 
Php :: missing view cakephp 
Php :: send sms by php diafaan 
Php :: capitlise php 
Php :: how to hide get parameters in url php 
Php :: erd in phpmyadmin 
Php :: cakephp 2 with customize link 
Php :: show date time with milliseconds php 
Php :: how to get the last inserted id in laravel 
Php :: laravel exists validation query two tables 
Php :: phpunit filter 
Php :: laravel-admin Model does not exists ! 
Php :: laravel make model and migration 
Php :: how to set session in laravel 
Php :: centos search directory php.exe 
Php :: how push to array whit key in laravel 
Php :: auto submit button php 
Php :: remove all spaces php 
Php :: get word between two characters php 
Php :: how to get all roles in wordpress 
Php :: what is forelse in laravel 
Php :: laravel collection each 
Php :: minuscule chaine php 
Php :: ext-bcmath php 8.0 install 
Php :: convert string to datetime symfony 
Php :: file_get_contents url fail 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =