Question
· Nov 1, 2016

File size.

Hi everybody,

My name is Sérgio Fernandes and I'm from Brazil.

I need to get the size of file that the user wants to upload in my application.

I'm getting it name with %request.GetMineData("fileName").FileName, but not found it at Ensemble documentation how would i get the size of file.

My version is Ensemble 2013.1.6.950.0 and I'm doing it at csp.

Thaks 

Discussion (3)0
Log in or sign up to continue

I would suggest to use client side javascript API to check the file size, instead of uploading it to server and check it.

I got a nice article on a blog.

<script language='JavaScript'> 
function checkFileSize(inputFile) {
        var max = 3 * 512 * 512; 
        if (inputFile.files && inputFile.files[0].size > max) { 
                alert("File is too large to upload."); 
                inputFile.value = null; 
        } 
} </script>