invoiceninja/app/controllers/AjaxController.php
Viktor Rennert 00fb18a52f Added ability to attach invoice as pdf to email templates.
Added flag in setting to turn pdf attachments on/off.
Client side generated pdf is uploaded on send email action.
Backend will check for actuall pdf.
Added dummy strings to all languages.

Added migration.
2015-03-15 18:54:40 +01:00

23 lines
652 B
PHP

<?php
class AjaxController extends BaseController
{
public function __construct()
{
parent::__construct();
}
public function pdfupload()
{
$uploadsDir = storage_path().'/pdfcache/';
if ($_FILES['fileblob']['error'] === UPLOAD_ERR_OK && $_FILES['fileblob']['type'] === 'application/pdf') {
$tmpName = $_FILES['fileblob']['tmp_name'];
$name = $_POST['filename'];
$finfo = new finfo(FILEINFO_MIME);
if ($finfo->file($tmpName) === 'application/pdf; charset=binary') {
move_uploaded_file($tmpName, $uploadsDir.$name);
}
}
}
}