public function xhr() { if (!MRights::can("upload")) { return $this->view->authError("upload"); } global $dir; $size = MRequest::int("size", null); if ($size === null) { return; } // print_r($_SERVER); die(); $fn = isset($_SERVER['HTTP_X_FILENAME']) ? MRequest::filter($_SERVER['HTTP_X_FILENAME'], MREQUEST_STRING) : false; if (!$fn) { return null; } $fileName = $dir . DS . $fn; file_put_contents($fileName, file_get_contents('php://input')); // Delete on abbort if (MFile::getSize($fileName) != $size) { MFile::remove($fileName); } $this->view->add2Content("ok"); }