How to limit uploading photo?
I want to limit uploading size of the user image. How can i do this? User should upload only jpg file and it would be less than 100kb. and is there any way i can convert that image into specific resolution? Thanks....
kirtan_thakkar
Junior Poster in Training
79 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
You can check the HTTP_POST_FILES array for the actual file size and gracefully reject larger files. There is also a PHP setting max_upload_size which can limit the upload size with a maybe not so user-friendly error message.
The uploaded file can be converted with the GD image library. Or install ImageMagick and use a system() call for external conversion.
smantscheff
Nearly a Posting Virtuoso
1,233 posts since Oct 2010
Reputation Points: 300
Solved Threads: 254
Hey, thanks Gewalop and pzuurveen for the wonderful posting. It solved my problem. Just a last question. User must be upload a jpg file. how can i do this? thanks in advanced..
kirtan_thakkar
Junior Poster in Training
79 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
Well Internet Explorer have always had its special ****ed way of doing things, and this is the header it actually sends for JPG files, while all the other browsers send "image/jpeg"
How does Internet Explorer send headers? For JPG or any other files? To whom?
smantscheff
Nearly a Posting Virtuoso
1,233 posts since Oct 2010
Reputation Points: 300
Solved Threads: 254