Code: Select all
if (isset($_SESSION["Media"]))
$pos = count($_SESSION["Media"]);
else
$pos = 0;
$_SESSION["Media[$pos]"] = new TempMedia($fileName, $mediaName, $mime);
throw new Exception("Uploaded media to SESSION[$pos]: " . $_SESSION["Media[$pos]"] . "; count is now " . count($_SESSION["Media"]));Uploaded media to SESSION[0]: test image.gif; count is now 0
...and indeed, on subsequent pages there will be no entries in $_SESSION["Media"]. I don't understand how $_SESSION["Media[0]"] can be set to a value, yet count($_SESSION["Media"]) remain zero. I could use a pseudo-array (Media1, Media2, etc.), but surely that's not necessary.
I have no problem getting the file information, or creating the TempMedia object, and there's no error to indicate that the problem is in writing to $_SESSION. I know that sessions are working in general, because my security is working fine (thanks to help from arborint and kaisellgren
Any ideas? Thanks!
Jonathan