Thread: Image upload
View Single Post
  #1 (permalink)  
Old October 15th, 2004, 06:02 AM
Pallav Pallav is offline
Authorized User
 
Join Date: Sep 2004
Location: , , .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Image upload

Hi,
I want to allow the users of my application to
upload image files using the "<INPUT type="file"> tag...

however i want to restrict the size(both pixel size and file size)
of the images being uploaded using javascript..

I am able to do so in IE with the following code..
<script language="JavaScript">
function checkSize()
{

    im = new Image();
    im.src = document.Upload.submitfile.value;

    alert(im.width);
    alert(im.height);
    alert(im.fileSize);
}
</script>
<html>
<body>
   <form name="Upload" action="MyUploadServlet"
  enctype="multipart/form-data" method="post">

     <p>Filename: <INPUT type="file" name="submitfile" >
     <INPUT type="button" value="Send" onClick="checkSize()">

    </form>
</body>
</html>

The above code works perfectly in IE6 but not in Mozilla v 1.7.1.

Could anybody please tell me the script for doin wat i want in
mozilla..???

Thanks...
Pallav