Browse Source

Rollback previous patch to compose.php because it breaks more than it
fixes. However, we should prefer using move_uploaded_file over rename
because move_uploaded_file works better with safe_mode/open_basedir
restrictions. Not doing that now because we're in rc phase.

Thijs Kinkhorst 22 years ago
parent
commit
315d3035eb
1 changed files with 6 additions and 3 deletions
  1. 6 3
      src/compose.php

+ 6 - 3
src/compose.php

@@ -1176,10 +1176,13 @@ function saveAttachedFiles($session) {
         $full_localfilename = "$hashed_attachment_dir/$localfilename";
     }
 
-    if (!@move_uploaded_file($_FILES['attachfile']['tmp_name'],$full_localfilename)) {
-        return true;
+    // FIXME: we SHOULD prefer move_uploaded_file over rename because
+    // m_u_f works better with restricted PHP installes (safe_mode, open_basedir)
+    if (!@rename($_FILES['attachfile']['tmp_name'], $full_localfilename)) {
+            if (!@move_uploaded_file($_FILES['attachfile']['tmp_name'],$full_localfilename)) {
+        	return true;
+    	    }
     }
-
     $message = $compose_messages[$session];
     $type = strtolower($_FILES['attachfile']['type']);
     $name = $_FILES['attachfile']['name'];