Android file parameter not working

I am trying to pass a file to server but it didn’t. server isn’t recognize file parameter.

how can I pass the file to server?

I am using this api on android. How can I pass a file with file parameter. I have been waiting for your answer

If you test the connection with Postman, do you get the same result?

You probably know it, but just in case: Postman is a free Chrome app, see Free OCR API

If you see the problem even with Postman, a screenshot of the result could be helpful.

I have no problem with postman.I have a problem about file parameter.server didn’t recognize file parameter

If the file parameter works in postman, the issue is somewhere in your code :wink:

String url = “https://api.ocr.space/Parse/Image”;

URL obj = new URL(url); // OCR API Endpoints
HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();

//add request header
con.setRequestMethod("POST");
con.setRequestProperty("User-Agent", "Mozilla/5.0");
con.setRequestProperty("Accept-Language", "en-US,en;q=0.5");

JSONObject postDataParams = new JSONObject();

postDataParams.put("apikey", "myapikey");
postDataParams.put("file",foto2);
postDataParams.put("language","tur");
postDataParams.put("isOverlayRequired", false);

where is the mistake?

ı have send file to server.but parsed text is null. why ?