Javascript How-ToAsk your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
You can't access the actual file in that manner. Remember that it is the input box in the form that you are accessing. To resize an image, you may be able to access it via javascript, but I'm not sure.
More than likely, you may need to use a server-side language for this.
Hi Brian ,
U seem to have misunderstood me.I don't want to resize an image.
I only want ot extract the image properties.
I am able to do so in IE6 but not in Mozilla v 1.7.1.
I guess if the javascript wrks in IE then there shud be a similar script for Mozilla too.
I believe that fileSize is a proprietary Microsoft addition.
Are you sure Moz is loading the image? (Afraid I don't have a copy of Moz so can't try it out)
Just for debug purposes, try adding an image tag to your page and setting the source of that to your input file. If that works OK add another button and see if you can get the h/w from the <img> tag. If this works then maybe the solution for Moz is to add a hidden img tag and use that to check the image dimensions. If it doesn't work, you will at least know which part doesn't work (loading the image or getting the size).
Hi Brian,
I am using the <input type="file"> tag to upload an image and i want to get the image height,width and image filesize before uploading the image..
My code works perfectly in IE6 but not in Mozilla v1.7.1.
I am looking for a solution 4 Mozilla.