Invalid image POST request JAVA

     

I try to upload an image file with POST request and get the following response from server:


Notice: Undefined index: width in /home/api.webbankir.com/methods/photo.php on line 32
Notice: Undefined index: width in /home/api.webbankir.com/methods/photo.php on line 37
Notice: Undefined index: height in /home/api.webbankir.com/methods/photo.php on line 32
Notice: Undefined index: height in /home/api.webbankir.com/methods/photo.php on line 37
Fatal error: Uncaught exception 'Exception' with message 'Invalid image:   /home/api.webbankir.com/tmp/d9864480da25e440ff4d591498881e79.jpg' in   /home/api.webbankir.com/include/Simpleimage.php:1081  Stack trace:#0 /home/api.webbankir.com/include/Simpleimage.php(512): SimpleImage->get_meta_data()  #1/home/api.webbankir.com/methods/photo.php(97): SimpleImage-  >load('/home/api.webba...')  #2 /home/api.webbankir.com/methods/photo.php(411): Photo->load(Array)  #3 {main}thrown in /home/api.webbankir.com/include/Simpleimage.php on line 1081  

Here is my JAVA code:


HttpURLConnection connection = null;  DataOutputStream outputStream = null;  String lineEnd = " ";  String twoHyphens = "--";  String boundary = "*****";
int bytesAvailable bufferSize;  byte[] buffer;  int maxBufferSize = 1024 * 1024;
try {
connection = null;   URL url = new URL(url_link);   connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);   connection.setDoOutput(true);   connection.setUseCaches(false);
connection.setRequestMethod("POST");
connection.setRequestProperty("Connection" "Keep-Alive");   connection.setRequestProperty("ENCTYPE