I have tried a lot on searching but could not find a working script for the limitation of the file size using javascript here below is my code but it is not working
if ($('#photo').get(0).files.size >1024 )
{
alert("Please select pic size less than 1 mb file .");
return false;
}
Where photo is id of input type file
files[0].sizesizeis in bytes. you need to divide it by 1024 to get KB and 1024 again to get MB. Ignoring the syntax error your code validates that the file is < 1KB