Nicky Manali Nicky Manali - 11 days ago 4x
MySQL Question

returning file size = -1 from server in android

I am making an android app in which i am fetching images from server which are stored in mysql i needed the file size before downloading and i am using this code

FileOutputStream fileOutput = new FileOutputStream(file);

InputStream inputStream = urlConnection.getInputStream();
int totalSize = urlConnection.getContentLength();

but always i am getting totalsize =
1.I dont know why this is happening.plz help me to resolve this issue


Seems the server is not setting Content-Length in the response header.