Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

419
Vistas
Get Javascript session in PHP (Symfony)

I'm trying to get a session variable value set in JS with PHP in back-end (I'm using Symfony).

I set my variable like so:

sessionStorage.setItem('test-name', file);

This works well because I can see in the browser console my session variable and its value. However, on the back-end, I'm unable to get it. I tried the following:

$this->get('session')->get('test-name');

But it doesn't work. What am I doing wrong?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Your JavaScript program and your PHP program are different programs running on (most of the time) different computers.

JavaScript's sessionStorage accesses a store inside the browser.

PHP's sessions access a store on the server.

They are not the same store.


If you want to store the data in a shared location, use the PHP session store. Allow JavaScript access to it by writing a web service and using Ajax to interact with it.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda