Store array on Session
Posted: Wed Jul 22, 2009 4:59 am
I'm trying to store an array on session but it doesn't seem to working...
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.
I'm not using any session_unset() and when i'm trying to use isset($_SESSION['images']) it's not returning anything (no "false" neither "true").
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;
}