Hello all,
In JSP / HTML, I want to restrict the size of file being uploaded.
<input type="file" name="myfile"/>
If the user trying to upload a file size bigger than some value say 5MB, i want to give mesage to the user. I don't want to wait till the file gets uploaded to server and then validate the file size. I am looking for client side validation. Can it be done using scripting language or any other way?
I need a solution for this in Internet Explorer. I got a solution using ActiveX control:
var myFSO = new ActiveXObject("Scripting.FileSystemObject");
[I]var filepath = document.getElementById('myfile').value;
var thefile = myFSO.getFile(filepath);
var sizeInBytes = thefile.size;
[/I]
But ActiveX controls are not allowed in our application. Is there any alternative way for this?
Please suggest the possible ways.. Thanks!!