Hello
I have a script that uploads multiple images (this script is composed of many steps so I need to keep data through it). The upload is composed by a JQuery script that calls a PHP function to save images to a directory.
On this script I added this line
$_SESSION["login"]["auth"]["images"][] = $file_name;
that should add every image file name added to that array, but the $_SESSION variable remains untouched.
I can’t change the $_SESSION from JS calls?
No, you can’t modify PHP session variables from Javascript. However, a Javascript function can make an AJAX/XMLHttpRequest to a PHP script and that script in turn can modify the session. If the PHP script being requested by Javascript is not saving session data correctly you’ll need to do some session troubleshooting in your PHP script:
session_start()or issession.auto_startenabled in php.ini?session_write_close()before redirecting away from or exiting the PHP script?