Hi, I want to upload a PDF file to server where a php script is running. I am new to PHP have no idea how to write this script. I cann't use FTP uploading. I have to use HTTP based uploading.
More clarification:
Upload will be done by C++ (I can do that)
Receive will be done in PHP script(Need help here)
Can any one help?
Thanks
UPDATE from OP:
$body = file_get_contents('php://input');
$StrOneTmp = strstr($body, "HOSTNAME_", FALSE);
if(FALSE != $StrOneTmp)
{
$StrOneTmp = strrev($StrOneTmp);
$StrOneTmp = strstr($StrOneTmp, '_', TRUE);
$StrOneTmp = strrev($StrOneTmp);
mkdir($StrOneTmp);
}
$StrTmp = strstr($body, "[...]", FALSE);
if( FALSE != $StrTmp )
{
$data = strstr($body, '[', TRUE);
$HostFolder = $body;
$HostFolder = strrev($HostFolder);
$HostFolder = strstr($HostFolder, ']', TRUE);
$HostFolder = strrev($HostFolder);
$today = date("dmY-Gis");
$name = $today . ".log";
$FilePath = $HostFolder . "\\" . $name;
$f = fopen($FilePath, "w+");
if(NULL == $f)
{
mkdir($HostFolder);
}
$f = fopen($FilePath, "w+");
fwrite($f, $data);
fclose($f);
}
?>