From a827b3d46b72f45ee832ce6462f02d8679129721 Mon Sep 17 00:00:00 2001 From: edward Date: Thu, 21 Jan 2016 13:22:38 +0800 Subject: [PATCH] DataObjects/Images.php --- DataObjects/Images.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/DataObjects/Images.php b/DataObjects/Images.php index 975b8026..e9826a50 100644 --- a/DataObjects/Images.php +++ b/DataObjects/Images.php @@ -644,7 +644,7 @@ class Pman_Core_DataObjects_Images extends DB_DataObject function onUploadFromData($filename, $filetype, $data, $roo) { - if (empty($filename) || empty($data)) { + if (empty($filename) || empty($filetype) || empty($data)) { $this->err = "Missing file details"; return false; } @@ -671,13 +671,9 @@ class Pman_Core_DataObjects_Images extends DB_DataObject } } - preg_match('/^data:([.]*);/', $data, $matches); - - print_r($matches);exit; - require_once 'File/MimeType.php'; $y = new File_MimeType(); - $this->mimetype = $_FILES['imageUpload']['type']; + $this->mimetype = $filetype; if (in_array($this->mimetype, array( 'text/application', 'application/octet-stream', @@ -687,7 +683,7 @@ class Pman_Core_DataObjects_Images extends DB_DataObject 'application/vnd.ms-excel', /// sometimes windows reports csv as excel??? 'application/csv-tab-delimited-table', // windows again!!? ))) { // weird tyeps.. - $inf = pathinfo($_FILES['imageUpload']['name']); + $inf = pathinfo($filename); $this->mimetype = $y->fromExt($inf['extension']); } -- 2.39.2