Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

417
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!