HttpPostedFileBase.ContentLength.ToString () returns "0"

0

Follow the code below:

HttpFileCollectionBase files;

I get the file size like this:

var tamanho = files[0].ContentLength; //tamanho é 1250

So far it works normal, when I want to convert to string:

var tamanho = files[0].ContentLength.ToString(); //para string "0"

With ToString() returns "0" . Why does this happen?

Update:

The following code works:

var tamanho = files[0].ContentLength;
var tamanho_string = tamanho.ToString(); //funciona "1250"

When I do ToString() direct, eg:

var tamanho = files[0].ContentLength.ToString(); // "0"
    
asked by anonymous 24.05.2018 / 18:04

0 answers