String and File

 

$dir = dirname(__FILE__);
$pos = strpos($dir, '/admin/');
if($pos == false) $pos = strpos($dir, '\\admin\\');
$root = substr($dir, 0, $pos) . '/uploads';
$image_size = array('187×142', '187×122', '800×600');
 
foreach($image_size as $key => $value){
$file = $root . '/' . $value . '/album/' . $project_id . '/' . $image;
try{
if(file_exists($file)) unlink($file);
}catch(Exception $e){
$err = $e->getMessage();
echo $err;
exit();
}
}

One thought on “String and File

  1. I’m impressed, I have to admit. Rarely do I come across a blog that’s equally educative
    and interesting, and without a doubt, you’ve hit the nail on the head. The problem is an issue that not enough men and women are speaking intelligently about. I’m very
    happy I came across this in my hunt for something concerning this.

Comments are closed.