File too big / Session timeout

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
TorMike
Forum Newbie
Posts: 17
Joined: Thu Feb 25, 2010 9:14 am

File too big / Session timeout

Post by TorMike »

So I'm uploading images files (JPG, PNG, GIF) using PHP $_FILE array.

I check the $_FILE['<username>']['error'], to ensure the value in NOT > 0. Should I also be checking the max_execution_time (set_time_limit) to ensure that the upload should be stopped prior to failing?

But how do you check whether it's taking too much time? How would you construct a IF-ELSE statement.

Any suggestions?
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: File too big / Session timeout

Post by VladSun »

If you don't want to increase session time, build a "session-live-keeper". It could be an IFRAME with a document with a self-refresh (e.g. every 1 minute) meta tag, reloading a dummy PHP file containing session_start().
Or you could do this with AJAX, JavaScript etc.
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply