2014-03-18 19:16:27 +08:00
|
|
|
<?php
|
|
|
|
$fileName = $_FILES['fileAttachment']['name'];
|
|
|
|
$fileType = $_FILES['fileAttachment']['type'];
|
|
|
|
$fileContent = file_get_contents($_FILES['fileAttachment']['tmp_name']);
|
|
|
|
$dataUrl = 'data:' . $fileType . ';base64,' . base64_encode($fileContent);
|
|
|
|
|
|
|
|
|
|
|
|
$json = json_encode(array(
|
2014-03-19 00:17:02 +08:00
|
|
|
'fileAttachment' => array(
|
|
|
|
'name' => $fileName,
|
|
|
|
'type' => $fileType,
|
|
|
|
'data' => $dataUrl
|
|
|
|
),
|
2014-03-18 19:16:27 +08:00
|
|
|
'from' => $_REQUEST['from'],
|
|
|
|
'subject' => $_REQUEST['subject'],
|
2014-03-19 00:17:02 +08:00
|
|
|
'body' => $_REQUEST['body'],
|
|
|
|
'nestedObject' => array(
|
|
|
|
'nest' => $_REQUEST["nestedObject.nest"]
|
|
|
|
)
|
2014-03-18 19:16:27 +08:00
|
|
|
));
|
|
|
|
|
|
|
|
echo $json;
|
|
|
|
?>
|