How to get content-length of file Im going to send?

view story

http://stackoverflow.com – I'm developing an application that can upload data to web server. But I don't know what I'm going to put on my content-length. I tried to get the size of my file and the other text-data that I'm going to upload but it's not correct. Can anyone know what should I gonna put on my content-length? for (chunkId = 0; chunkId < chunks; chunkId++) { URL url = new URL(urlString); // Open a HTTP connection to the URL conn = (HttpURLConnection) url.openConnection(); conn.setReadTimeout(20000 /* milliseconds */); (HowTos)