Copy link to clipboard
Copied
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..
according to my workmate.. this is not possible with Javascript or Ajax.. is there any other method i can use?
kindly help.. thanks
This is a good answer, but it's worth pointing out that Flash Player is itself an ActiveX control (when run from within IE). In short, you need something beyond code that runs directly in the browser to do this. It can't be done with just HTML and JavaScript in a web page.
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/
Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at ou
...Copy link to clipboard
Copied
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
reasons.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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:
http://sujitreddyg.wordpress.com/2008/11/04/filereference-in-flash-player-10/
Cheers
Kai
Copy link to clipboard
Copied
This is a good answer, but it's worth pointing out that Flash Player is itself an ActiveX control (when run from within IE). In short, you need something beyond code that runs directly in the browser to do this. It can't be done with just HTML and JavaScript in a web page.
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/
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:
http://forums.adobe.com/thread/607238