Re: move_uploaded_file

From: Date: Fri, 11 Dec 2009 18:51:48 +0000
Subject: Re: move_uploaded_file
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-300392@lists.php.net to get a copy of this message
HI, Premise 1: echo exec("pwd"); -> "/home/prof3ta/projects/moodle/htdocs/feedback_tool" Premise 2: I have an "upload" folder with 777 permissions under: /home/prof3ta/projects/moodle/htdocs/upload Premise 3: The server root is obviously htdocs: /home/prof3ta/projects/moodle/htdocs This said, the following doesn't work: <?php $uploads_dir = "/upload"; $tmp_name = $_FILES["file"]["tmp_name"]; $name = $_FILES["file"]["name"]; move_uploaded_file($tmp_name, "$uploads_dir/$name"); ?> The following does work: <?php $uploads_dir = "../upload"; $tmp_name = $_FILES["file"]["tmp_name"]; $name = $_FILES["file"]["name"]; move_uploaded_file($tmp_name, "$uploads_dir/$name"); ?> I consider it as a documentation bug (in the sample code they use an absolute path). I indeed believe I *should* be able to use both of them if not documented otherwise. I will dig into the C implementation of the move_uploaded_file function and I'll check, though. Cheers, Roberto Aloi http://aloiroberto.wordpress.com Twitter: @prof3ta

« previous php.general (#300392) next »