http request return 400 Bad Request

I sent binary image data to my php server and it returns 400 bad request error as belows.
I’m using ArduCam and arduino for arducam.

HTTP/1.1 400 Bad Request
Date: Sun, 13 May 2018 09:41:26 GMT
Server: Apache
X-Frame-Options: SAMEORIGIN
Content-Length: 226
Connection: close
Content-Type: text/html; charset=iso-8859-1

400 Bad Request

Bad Request

Your browser sent a request that this server could not understand.

This is how I request in arduino.
As you can typed or

if (client.connect(“”, 80)== 1) {
while(client.available()) {String line = client.readStringUntil(’\r’);} // Empty wifi receive bufffer

String start_request = “”; String end_request = “”;
start_request = start_request +
“\n–AaB03x\n” +
“Content-Disposition: form-data; name=“userfile”; filename=“CAM.JPG”\n” +
“Content-Transfer-Encoding: binary\n\n”;

end_request = end_request + “\n–AaB03x–\n”; // in file upload POST method need to specify arbitrary boundary code

uint16_t full_length;
full_length = start_request.length() + len + end_request.length();

Serial.println(“POST/mobilewebcam.php HTTP/1.1\r\n”);
Serial.println(“Host:\r\nConnection: close\r\n”);
Serial.println(“Content-Type: multipart/form-data; boundary=AaB03x”);
Serial.print("Content-Length: "); Serial.println(full_length);
Serial.print(start_request); Serial.println(“Here are sent picture data”); Serial.println(end_request);

client.println(“POST/mobilewebcam.php HTTP/1.1\r\n”);
client.println(“Host:\r\nConnection: close\r\n”);
client.println(“Content-Type: multipart/form-data; boundary=AaB03x”);
client.print(“Content-Length: “); client.print(full_length);client.println(”\r\n”);

// Read image data from Arducam mini and send away to internet
static const size_t bufferSize = 1024; // original value 4096 caused split pictures
static uint8_t buffer[bufferSize] = {0xFF};
while (len) {
size_t will_copy = (len < bufferSize) ? len : bufferSize;
SPI.transferBytes(&buffer[0], &buffer[0], will_copy);
if (!client.connected()) break;
client.write(&buffer[0], will_copy);
len -= will_copy;

myCAM.CS_HIGH(); digitalWrite(led, HIGH);
Serial.println(“Not fonnected”);

// Read the reply from server
while(client.available()){ String line = client.readStringUntil(’\r’); Serial.print(line);}

Php source code for mobilewebcam.php

<?php // new file uploaded? $uploadfile = ""; echo "uploading "; echo $_FILES["userfile"]["name"]; if(strlen(basename($_FILES["userfile"]["name"])) > 0) { $uploadfile = basename($_FILES["userfile"]["name"]); if(move_uploaded_file($_FILES["userfile"]["tmp_name"], $uploadfile)) { @chmod($uploadfile,0777); echo " Ok! "; $weekago = mktime(date('H')+0, date('i'), date('s'), date('m'), date('d'), date('y')); echo "aaa "; if (file_exists("old/".date('Y_m_d', $weekago) )) { print("Directory already exists.\n"); } else { mkdir("old/".date('Y_m_d', $weekago)); copy("index.php","old/".date('Y_m_d', $weekago)."/index.php"); print("Directory creating.\n"); } if (file_exists("old/".date('Y_m_d', $weekago)."/".date('H', $weekago) )) { print("Directory already exists.\n"); } else { mkdir("old/".date('Y_m_d', $weekago)."/".date('H', $weekago)); copy("index1.php","old/".date('Y_m_d', $weekago)."/".date('H', $weekago)."/index.php"); print("Directory creating.\n"); } echo "add to arch "; copy($uploadfile,"old/".date('Y_m_d', $weekago)."/".date('H', $weekago)."/".date('Y.m.d_H-i-s', $weekago).".jpg"); //copy($uploadfile,"old/".date('Y_m_d', $weekago)."/".date('Y.m.d_H:i:s', $weekago).".jpg"); //copy($uploadfile,"old/".date('Y_m_d', $weekago)."/".date('Y_m_d_H:i', $weekago).".jpg"); rename($uploadfile,"current.jpg"); } else echo " Error copying!"; } echo date('Y.m.d_H:i', $weekago); ?>

You are aware that println() already adds a carriage return and line feed characters ? So \r\n sends these again.

client.println("POST/mobilewebcam.php  HTTP/1.1\r\n");

Have you access to the Apache Server access logs? You may see some hint there about what is going wrong.
Which tutorial are you following for using the HTTP POST method with Arduino ?

replace all single \n with \r\n

There needs to be a space after the POST keyword.