This is a weird problem that is hard to reproduce.
I leave my computer on pretty much 24x7 and I am logged in to chat all the time. Randomly, every few days, when I try to upload a picture, the upload starts but instead of submitting the picture, it logs me out.
I can't easily reproduce and it is at complete random, but it has probably happened around 15 times since I started using chat.
Just now was one example, I wrote some text (fine), uploaded a picture (fine), then I uploaded another picture to be straight after and it changed to the grey box at the bottom saying I need to be logged in.
Today was easy, I clicked the link, got the notification at the top saying I am in and I went back... other times it doesn't log me in and I have to clear cookies and do the usual mucking around.
Sorry I can't be more help in diagnosing, but as I said, it is very random.