954,591 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Possible to let the user know the image is too large

Technically I do not think its possible but thought I would ask. I have a form that contains multiple image upload fields, in the description we ask that the images size be smaller than 1mb but most people simple do not know how to check this.
Typically people will load each of the 5 image fields with an image over 2mb and wonder why the page timed-out or is blank after a couple of minutes.
Can PHP or something check this before the form gets rolling, then warn them about the size or time it will take to load these images?

Bonus
Newbie Poster
3 posts since Jan 2007
Reputation Points: 10
Solved Threads: 0
 

PHP does offer built in functions for manipulating images. With these you can find out an images dimensions and then react accordingly.

stymiee
He's No Good To Me Dead
Moderator
3,360 posts since May 2006
Reputation Points: 161
Solved Threads: 38
 

Check the $_FILES['file']['size'] and return a message if the size exceeds the limit.

However, if the php settings limit the size, it will return 0 for size. Thus you can check $_FILES['file']['error'] for error the code ( http://www.php.net/manual/en/features.file-upload.errors.php) .

php_daemon
Junior Poster
140 posts since Aug 2006
Reputation Points: 13
Solved Threads: 2
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You