Please explain more in detail what you are trying to do. Is there a server running on your Windows pc? Why do you think, these headers are necessary? Is there any API documentation?
<?php
// Simple PHP script to save image file.
$imgDir = "images/";
$fileName = $_REQUEST['fname'];
$data = file_get_contents('php://input');
$store = file_put_contents($imgDir.$fileName, $data);
if ($store !== false ) {
echo "File $fileName saved to server, $store bytes\n";
} else {
echo "File $fileName not saved\n";
}
?>
But it does not work with a windows IIS web server.
This is my PHP code but it never gets executed as the PostFile request from my MIT App Inventor App never reaches my web page.
Instead I get the 500 error in my app.
// File upload?
else if (!empty($_POST))
{
$strMemberID = "";
if (IsLogoImageUpload($strMemberID))
{
if (strlen($strMemberID) > 0)
{
$strProfileFilename = DoGetProfileImageFilename($strMemberID);
$results = DoUpdateQuery1($g_dbFindATradie, "members", "profile_filename", $strProfileFilename);
if ($results)
{
$data = file_get_contents('php://input');
$nBytes = file_put_contents($strProfileFilename, $data);
if ($nBytes > 0)
echo "OK";
else
echo "File '" . $strProfileFilename . "' could not be saved!";
}
else
{
echo "Could not update 'profile_filename' column for member '" . $strMemberID . "'!";
}
}
else
{
echo "PROFILE image file name member ID is blank!";
}
}
else
{
//print_r($_POST);
}
}