Hello, i want to ask how can i detect the filesize before i upload to server. i have here an example i found it on the net. but the problem, it detects only the size of an image file, what i need is to validate any files specially audio files. If you have any idea pls help.. thanks <head> <script type="text/javascript"> function showSize(f) { if ((new Image()).fileSize) { var img = new Image(); img.onload = imgOnload; img.onerror = imgOnerror; img.src = f.elements['myFile'].value; } } function imgOnload() { if (this.fileSize) { var size = this.fileSize; if (size > 1024) { size = Math.round((size / 1024) * 100) / 100; } document.write( 'The file is ' + size + (this.fileSize > 1024 ? ' kilobytes' : ' bytes') + ' in size.' ); } } function imgOnerror() { alert('The file is not an image or did not load.'); } </script> </head> <body> <form name="myForm"> <input type="file" name="myFile" onchange="showSize(this.form);"> </form> Code (markup):