#39051 [Opn->Fbk]: move_uploaded_file fails with spaces and apostrophes
| From: | tony2001@php.net | Date: | Thu, 05 Oct 2006 17:49:43 +0000 |
| Subject: | #39051 [Opn->Fbk]: move_uploaded_file fails with spaces and apostrophes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-103157@lists.php.net to get a copy of this message | ||
ID: 39051
Updated by: tony2001@php.net
Reported By: steele at agora-net dot com
-Status: Open
+Status: Feedback
Bug Type: Streams related
Operating System: Debian Sarge
PHP Version: 4.4.4
New Comment:
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
Previous Comments:
------------------------------------------------------------------------
[2006-10-05 17:42:48] steele at agora-net dot com
Forgot to paste the "Upload error!" at the end.
------------------------------------------------------------------------
[2006-10-05 17:41:39] steele at agora-net dot com
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 this bug report at http://bugs.php.net/?id=39051&edit=1