From 6e6beee29a8140ee854a68e83c769554c01513fb Mon Sep 17 00:00:00 2001 From: jabourne Date: Thu, 19 Jan 2017 02:47:03 -0700 Subject: [PATCH] Update um-image-upload.php to prevent overwrite of multiple image uploads with the same name, I've added the $id to the filename just prior to the sanitize_file_name() call. --- core/lib/upload/um-image-upload.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/lib/upload/um-image-upload.php b/core/lib/upload/um-image-upload.php index 3b67c656..6eb15c52 100644 --- a/core/lib/upload/um-image-upload.php +++ b/core/lib/upload/um-image-upload.php @@ -35,7 +35,7 @@ if(isset($_FILES[$id]['name'])) { if(!is_array($_FILES[$id]['name'])) { $temp = $_FILES[$id]["tmp_name"]; - $file = $_FILES[$id]["name"]; + $file = $id."-".$_FILES[$id]["name"]; $file = sanitize_file_name($file); $ext = strtolower( pathinfo($file, PATHINFO_EXTENSION) ); @@ -55,4 +55,4 @@ if(isset($_FILES[$id]['name'])) { } else { $ret['error'] = __('A theme or plugin compatibility issue','ultimatemember'); } -echo json_encode($ret); \ No newline at end of file +echo json_encode($ret);