/* function used for showing charts on print screen */
static function uploadChartImage() {
// upload strictly for '.png' images
- $name = CRM_Utils_Request::retrieve('name', 'String', CRM_Core_DAO::$_nullObject, FALSE, NULL, 'GET');
- if (preg_match('/\.png$/', trim($name))) {
+ $name = trim(basename(CRM_Utils_Request::retrieve('name', 'String', CRM_Core_DAO::$_nullObject, FALSE, NULL, 'GET')));
+ if (preg_match('/\.png$/', $name)) {
//
// POST data is usually string data, but we are passing a RAW .png
// so PHP is a bit confused and $_POST is empty. But it has saved
}
// full path to the saved image including filename
- $destination = $defaultPath . basename($name);
+ $destination = $defaultPath . $name;
//write and save
$jfh = fopen($destination, 'w') or die("can't open file");
CRM_Utils_System::civiExit();
}
}
-}
-
+}
\ No newline at end of file