When you drag and drop the value, it puts in code for displaying it using php. The part you are interested in storing is the actual value, which looks like this:
To get around the error you are getting, you would want to use an if statement to check if the upload has been successful before storing the information:
If the upload hasn't been performed or errors that value will be -1. If the upload is successful the value will be 1 (true).
In the if statement that is where you will set the session variables.