0
I’m trying to put a message for when it exceeds the file size in Fileupload, already arranged inside the web config, but always returns me the following error:
Maximum request size exceeded.
I saw this example on the internet, I tried to adapt it to my code but keeps appearing the above error:
<script type ="text/javascript">
$(function () {
$('<%= Anexo.ClientID %>').change(function () {
//because this is single file upload I use only first index
var f = this.files[0]
//here I CHECK if the FILE SIZE is bigger than 8 MB (numbers below are in bytes)
if (f.size > 8388608 || f.fileSize > 8388608) {
//show an alert to the user
alert("Allowed file size exceeded. (Max. 8 MB)")
//reset file upload control
this.value = null;
}
})
});
</script>
I have seen several examples on the Internet, I have tried several ways, I have searched here on the forum and others on the Internet, but no example is occurring the message that the size was exceeded.