I'm downloading a file in my android app and I want to display a progressbar. I need to know the total file size by using this method : here. The problem is that I always get -1 despite the fact that it's set on the server and I can see it from my computer.
This is the code :
URL url = new URL(fileUrl);
URLConnection ucon = url.openConnection();
ucon.connect();
int length = ucon.getContentLength();
What is the problem ?