#39051 [NEW]: move_uploaded_file fails with spaces and apostrophes
| From: | steele at agora-net dot com | Date: | Thu, 05 Oct 2006 17:41:39 +0000 |
| Subject: | #39051 [NEW]: move_uploaded_file fails with spaces and apostrophes | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-103155@lists.php.net to get a copy of this message | ||
From: steele at agora-net dot com
Operating system: Debian Sarge
PHP version: 4.4.4
PHP Bug Type: Streams related
Bug description: move_uploaded_file fails with spaces and apostrophes
Description:
------------
The move_uploaded_file() function fails when given a path that contains
spaces or apostrophes. Have tried manually escaping them as well, with
the same result. The copy() function does not fail in this respect.
Tested on three separate machines, and had members in the IRC channel test
as well.
Reproduce code:
---------------
$target_path = "/path/to/share/ftp/foo blah/bc.png";
if(move_uploaded_file($_FILES[$fileName]['tmp_name'],$target_path)){
echo basename( $_FILES[$fileName]['name']) . " has been successfully
uploaded.\n";
}
else{
echo "Upload error!";
}
Expected result:
----------------
bc.png has been successfully uploaded.
Actual result:
--------------
Warning: move_uploaded_file(/path/to/share/ftp/foo blah/bc.png)
[function.move-uploaded-file]: failed to open stream: No such file or
directory in /path/to/includes/doUpload.php on line 54
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to
move '/tmp/phpu6A5ia' to '/path/to/share/ftp/foo blah/bc.png' in
/path/to/includes/doUpload.php on line 54
--
Edit bug report at http://bugs.php.net/?id=39051&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39051&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39051&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39051&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39051&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=39051&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39051&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39051&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39051&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39051&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39051&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=39051&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=39051&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39051&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39051&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39051&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39051&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39051&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39051&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39051&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39051&r=mysqlcfg