I'm creating a CMS using tinymce and when a user creating a page I wan't to keep the path of the images that user upload on the ftp and when he finishes just check which images he finally keep and delete the orphan ones.
Code: Select all
if(isset($_SESSION['images']) || $_SESSION['images'] != "" || $_SESSION['images'] != null){
$imagesArray = array();
foreach ($_SESSION['images'] as $key=>$value)
array_push($imagesArray,$value);
foreach ($imagesArray as $key => $value){
if ($value == $imageToUpload)
$imgExist = true;
else
$imgExist = false;
}
if ($imgExist)
$_SESSION['images']=$imagesArray;
else{
array_push($imagesArray,$imageToUpload);
$_SESSION['images']=$imagesArray;
}
}else{
$imagesArray = array($imageToUpload);
$_SESSION['images']=$imagesArray;
}