summaryrefslogtreecommitdiff
path: root/inc/media.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/media.php')
-rw-r--r--inc/media.php17
1 files changed, 14 insertions, 3 deletions
diff --git a/inc/media.php b/inc/media.php
index 05f22719f..792064c0a 100644
--- a/inc/media.php
+++ b/inc/media.php
@@ -185,13 +185,24 @@ function media_upload($ns,$auth){
global $lang;
global $conf;
- // get file
+ // get file and id
$id = $_POST['id'];
$file = $_FILES['upload'];
- // get id
if(empty($id)) $id = $file['name'];
- $id = cleanID($ns.':'.$id); //FIXME handle relative and absolute names here
+
+ // check extensions
+ list($fext) = mimetype($file['name']);
+ list($iext) = mimetype($id);
+ if($fext && !$iext){
+ // no extension specified in id - readd original one
+ $id .= '.'.$fext;
+ }elseif($fext && $fext != $iext){
+ // extension was changed, print warning
+ msg(sprintf($lang['mediaextchange'],$fext,$iext));
+ }
+
// get filename
+ $id = cleanID($ns.':'.$id);
$fn = mediaFN($id);
// get filetype regexp