P粉6383439952023-08-09 11:37:21
You are encountering a file system-based session problem. The upload script locks the session backend file during execution, so the session information cannot be accessed until the lock is released.
The simplest one is to have your upload script periodically release and relock the session; at the same time, this will provide your progress script with an opportunity to read the session.
To release the session lock, call session_write_close anywhere in the upload script. Doing so will prevent you from accessing the session variables until session_start is called again later. You can repeat this cycle.
There are other more powerful solutions. For example, you could move the progress information to some storage mechanism that doesn't hold a lock during script execution; you could identify each user's information based on the session ID (if a session exists, you don't need to start it to get its ID )