开发者

Prevent session timeout on big uploads

Pretty obvious from the title I guess :)

Well, problem is that if user is uploading a big file, his session might timeout in that time. How cou开发者_Python百科ld I prevent session timeouts?

I am using Struts2 with AjaxUpload.


Have another request (in paralel) to the server in intervals smaller than the session timeout.

(This is of course only as long as the upload is not finished.)

e.g. request for an image / URL (existing or missing) using AJAX / Iframe / Image tag every X seconds (if your session timeout is 30, I would try 20 or 15 just to make sure...

Notes: If you request a missing URL / Image you will result in a 404 in the logs and if you request a real URL / Image make sure it is cached and never expires to avoid clogging

Works for us...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜