backbone-model-file-upload/tests/upload-test.php
homeslicesolutions cdcd63b31c Initial commit
2014-03-18 04:16:27 -07:00

18 lines
475 B
PHP

<?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(
'fileName' => $fileName,
'fileType' => $fileType,
'dataUrl' => $dataUrl,
'from' => $_REQUEST['from'],
'subject' => $_REQUEST['subject'],
'body' => $_REQUEST['body']
));
echo $json;
?>