fixed bug #585340
[squirrelmail.git] / src / compose.php
index 0e24912ae5513d1340d5c02b6d601851317378b6..83ffe5c24f77b8c89b191b9e3be091a2596a0ce1 100644 (file)
@@ -899,9 +899,17 @@ function saveAttachedFiles($session) {
     }
 
     if (!@rename($HTTP_POST_FILES['attachfile']['tmp_name'], $full_localfilename)) {
-        if (!@copy($HTTP_POST_FILES['attachfile']['tmp_name'], $full_localfilename)) {
+       if (function_exists("move_uploaded_file")) {
+               if (!@move_uploaded_file($HTTP_POST_FILES['attachfile']['tmp_name'], $full_localfilename)) {
             return true;
-        }
+               }
+       } else {
+
+               if (!@copy($HTTP_POST_FILES['attachfile']['tmp_name'], $full_localfilename)) {
+                   return true;
+                       }
+       }
+
     }
 
     $newAttachment['localfilename'] = $localfilename;