image upload keeps file name ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Guys,

Can someone confirm for me that the code below will move an uploaded file and give it the same name as the original image file name ?


$file_dir = "/home/uploads";
foreach($_FILES as $file_name => $file_array) {
	echo "path: ".$file_array["tmp_name"]."<br/>\n";
	echo "name: ".$file_array["name"]."<br/>\n";
	echo "type: ".$file_array["type"]."<br/>\n";
	echo "size: ".$file_array["size"]."<br/>\n";
	
	$UploadName[$num] = $file_array["name"];
    $num++;

	if (is_uploaded_file($file_array["tmp_name"])) {
move_uploaded_file($file_array["tmp_name"], "$file_dir/". $file_array["name"]) or die ("Couldn't copy");
		echo "file was moved!<br/>";
	}
}



Many thanks,





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux