From e6675f9a094b58b0cdf72674799d239c928ec580 Mon Sep 17 00:00:00 2001 From: kink Date: Wed, 15 Jan 2003 12:31:33 +0000 Subject: [PATCH] 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. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@4420 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- src/compose.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/compose.php b/src/compose.php index fd7e07cc..fef9c415 100644 --- a/src/compose.php +++ b/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']; -- 2.25.1