hi there guys..
i'm having a problem at the moment.. how can i check the file size before it is submitted to the server?
i was given a task to check if the file size limit is more than 500kb then block the upload and notify user..
kindly help.. thanks
Pretty sure it can't be done without an AIR app or an ActiveX control or
something like that which gets installed on the user's machine. Otherwise
the browser is the only interface to the user's harddrive, and it's not
allowed to simply run file size checks on local files, for obvious security
I once wrote a very simple Active X script to do this. However, when I ran the page with IE I was prompted to allow that script to run. With FF, I could not get the script to run.
If there is an answer, it lies elsewhere.
It can be easily done with a Flash-based upload widget - no AIR or ActiveX control required - provided you are happy to build and deploy for Flash Player 10+. I've built an uploader for a client recently that checks the image size and dimensions and then does a client-side image resizing process and uploads the final image to a CF endpoint.
You want to have a further look into the FileReference API in Flex, here's a good blog post to start with:
Dave Watts, CTO, Fig Leaf Software
Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite.
Read this before you post: