I am using CURL to download a large file from an external url and save it on my server. This can take up to few minutes. While the download is running I\'m using the curl_se
You have the classic problem with filesystem-backed sessions. Your upload script locks the session backing file for its duration, so it's impossible to get access to the session information until it releases the lock.
There are several possible solutions here, but the easiest one would be for your upload script to periodically release the session and lock it again; this would leave opportunity for your progress script to read the session in the meantime.
To release the session lock, call session_write_close at any point from your upload script. This leaves you without access to session variables until you call session_start
again later on. You can repeat this cycle as much as you like.
There are also other, more capable solutions. For example you could move the progress information to some storage mechanism that does not stay locked for the duration of a script; you can identify each user's information based on their session id (you don't need to start the session to get its ID, if one exists).