Not able to upload image from nodemcu sd card to web server via rest api

Below is my nodemcu esp8266-12 code and php code of server.
The code prints done on the serial monitor but the image is not uploaded on the server.
I’ve tried doing the same thing with python requests module on my pc, it works there but it’s not working with nodemcu.
This is what it prints on the serial monitor -

Connected to Server
…done
426
255
0
respcode: 72
HTTP/1.1 200 OK
Date: Sat, 03 Aug 2019 12:29:30 GMT
Server: Apache/2.4.18 (Ubuntu)
Vary: Accept-Encoding
Content-Length: 72
Connection: close
Content-Type: text/html; charset=UTF-8

B Sorry, there was an error uploading your file.
The tmp name is

Any help would be hugely appreciated. TIA!

nodemcu code

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <SD.h>
#include <SPI.h>
#include "FS.h"

const char* ssid     = "ssid"; //change it
const char* password = "password";
File webFile;
char servername[] = "example.com"; //change it
WiFiClient client;

unsigned long laikas;

void setup() {
  Serial.begin(230400);
  // We start by connecting to a WiFi network
  SPIFFS.begin();
  SD.begin(4);
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("WiFi connected,");
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.println(rssi);

  laikas = millis();
  //webFile = SPIFFS.open("/2.jpg", "r"); //change it
  webFile = SD.open("2.jpg", FILE_READ);
  if (!webFile) {
    Serial.println(F("File open faild"));
    return;
  }

  Serial.println(webFile);

  //webFile.close();
  laikas = millis() - laikas;
  //prints time since program started
  Serial.println(laikas);
  laikas = millis();
  //SIUNTIMAS HTTTP
  if (client.connect(servername, 80)) {
    client.setNoDelay(true);
    Serial.println("Connected to Server");

    laikas = millis();
    // Make a HTTP request:
    client.println("POST /mcu_file_upload.php?azyx=1&d=1 HTTP/1.1");
    client.println("Host: example.com"); //change it
    client.println("Connection: close");
    //client.println("Cache-Control: max-age=0");
    client.println("Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryjg2qVIUS8teOAbN3");
    client.println("Content-Length: 3494"); //file size  //change it
    client.println();
    client.println("------WebKitFormBoundaryjg2qVIUS8teOAbN3");
    client.println("Content-Disposition: form-data; name=\"FileGDF\"; filename=\"2.jpg\""); //change it
    client.println("Content-Type: application/octet-stream");
    client.println();
    client.write(webFile);
    client.println(); //file end

    client.println("------WebKitFormBoundaryjg2qVIUS8teOAbN3--");
    client.println();
    webFile.close();
    Serial.println("done");
  }
  laikas = millis() - laikas;
  //prints time since sending started
  Serial.println(laikas);
  byte respCode = client.peek();
  Serial.println(respCode);

  // Read all the lines of the reply from server and print them to Serial
  byte thisByte;
  while (client.available()) {
    thisByte = client.read();
    Serial.write(thisByte);
    //Serial.println("0");
  }
  Serial.println("0");

  if (!eRcv())
    Serial.println(client.peek());
  client.stop();
  SPIFFS.end();
}

void loop() {
}

byte eRcv()
{
  byte respCode;
  byte thisByte;
  while (!client.available()) delay(1);
  respCode = client.peek();
  Serial.print("respcode: ");
  Serial.println(respCode);
  while (client.available())
  {
    thisByte = client.read();
    Serial.write(thisByte);
  }
  return 1;
}

php code

<?php
$target_dir = "uploads/";
$filename = basename(@$_FILES["FileGDF"]["name"]);
$target_file = $target_dir . $filename;
$uploadOk = 0;
$FileType = pathinfo($target_file,PATHINFO_EXTENSION);

if(isset($_GET["azyx"])&&(isset($_GET["d"]))) {
  if (file_exists($target_file)) {
    if (file_put_contents($target_file,file_get_contents(@$_FILES["FileGDF"]["tmp_name"]))){
      echo "The file ". $filename. " has been uploaded.
";
      $uploadOk = $uploadOk + 1;
    } else {
      echo "A Sorry, there was an error uploading your file.
";
    }
  }else{
    echo $_FILES["FileGDF"]["tmp_name"];
    if (move_uploaded_file(@$_FILES["FileGDF"]["tmp_name"], $target_file)) {
      echo "The file ". basename($filename). " has been uploaded.
";
      $uploadOk = $uploadOk + 1;
    } else {
      echo "B Sorry, there was an error uploading your file.
 The tmp name is " . @$_FILES["FileGDF"]["tmp_name"];
    }
  }
}
else{
echo 'HAHA';
}
?>