|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39575 move_uploaded_file no longer working (safe mode related)
Submitted: 2006-11-21 23:08 UTC Modified: 2006-11-22 11:55 UTC
From: ch at hoffie dot info Assigned:
Status: Closed Package: Safe Mode/open_basedir
PHP Version: 5CVS-2006-11-21 (snap) OS: Linux 2.6
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: ch at hoffie dot info
New email:
PHP Version: OS:


 [2006-11-21 23:08 UTC] ch at hoffie dot info
While move_uploaded_file() correctly worked with PHP 5.2.0, it stopped working with recent snapshots of 5.2.1-dev (maybe earlier). Appearently PHP (main/safe_mode.c?) checks whether the target file exists -- and this obviously is never true for a file which is going to be moved there (but isn't there yet).

./configure --disable-all --disable-cli --enable-fastcgi

Reproduce code:
(with safe_mode enabled and a correct file upload POST request)
  move_uploaded_file($_FILES['foo']['tmp_name'], "test.gif");

Expected result:
The POSTed file should be moved to "test.gif" like in earlier PHP versions.

Actual result:
Warning: move_uploaded_file(): Unable to access /www/test.gif in /www/upload.php on line 2

No test.gif appears (although the permissions are correct; the uid of PHP is the same as the directory where test.gif should be put; nothing has been changed since the update from 5.2.0 to today's cvs snapshot)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-22 11:55 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Sep 28 15:01:25 2023 UTC