Struggled with this for a few hours now so time to ask a question.
Im sending a multipart http post from android to php server using apachehttpclient jar package.
Once the info is posted to php im trying to save the image to a folder so I can work with it:
<?php
require("fpdf.php");
//Receive the data from android
$name = $_POST['email'];
$data = $_POST['data'];
//Receive the file
$file = $_FILES['image'];
//$newpath = "/";
//file_put_contents($newpath, $file);
if(move_uploaded_file($file, $newpath)) {
echo json_encode(
array(
'result'=>$data,
'msg'=>'Report added successfully.'
)
);
}else {
//something else
};
?>
I have tried move_upload_file as above and also file_put_contents($newpath, $file);
Any help greatly appreciated.
This is the php script i use for uploading photos to server from ios applications.