Checking a jpg file size before uploading


I am wondering if this can be achieved with PHP. Can you check a jpg file size before uploading?

I am writing a script that will limit the size of the jpg files to be uploaded by the end user. I want the script to block the upload either before or shortly after the start of the upload. I doubt it will be possible with a server side script but could it be possible with a combination of PHP and JavaScript?

Any ideas?


You would need Flash/Silverlight or some HTML 5 mojo (not fully supported) either way you still need to check the file size after it is uploaded.

Hello, Thanks for the answer… you pointed me to right direction
I cannot use Flash/Silverlight but for sure I can use HTML5 and… in the HTML5 file API there is exactly what I want

I guess I will have to move the thread to the HTML forum :slight_smile: