php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32023 move_uploaded_file ignore destination and put to default tmp
Submitted: 2005-02-18 18:29 UTC Modified: 2005-02-21 18:54 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: sopak at matrixway dot cz Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.3.10 OS: linux
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sopak at matrixway dot cz
New email:
PHP Version: OS:

 

 [2005-02-18 18:29 UTC] sopak at matrixway dot cz
Description:
------------
move_uploaded_file ignore destination 

if destination  contains  any relative path function will put file to default tmp(and no error message is sent, and strip relative path) , without(move to actual position) path or with absolute path will function move file to right destination

I used php 4.3.10
safe_mode on
base_dir I checked  twice ;]

I can tell this  bug was not in 4.3.9

Reproduce code:
---------------
                                                                $downloadDir="./tmp"; //local TMP dir in my space
                                                                $file=$downloadDir."upload_".md5($HTTP_POST_FILES['file']['tmp_name']);
                                                                move_uploaded_file($HTTP_POST_FILES['file']['tmp_name'],$file);
                                                                
//file  is  stored in /tmp/$file have to be  in ./tmp/$file


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-21 18:54 UTC] tony2001@php.net
move_uploaded_file() doesn't use any PHP ini options, so it can't move files to "default tmp dir", as it doesn't know about it.
Check your code and always use absolute path. 
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 04 23:01:33 2025 UTC