<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> uploadFile2.php </title>
<meta charset="GBK">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body>
<?php
var_dump($_FILES);
if(!empty($_FILES))
{
if($_FILES['upfile']['error']==0)
{
//'upfile' =>
//array
//'name' => string 'CakePHP手册.chm' (length=17)
//'type' => string 'application/octet-stream' (length=24)
//'tmp_name' => string 'D:\wamp\tmp\php3BC8.tmp' (length=23)
$ret=move_uploaded_file($_FILES['upfile']['tmp_name'],'up\\'.$_FILES['upfile']['name']);
var_dump($ret);
if($ret)
{
echo '上传成功:'.$_FILES['upfile']['name'] . '<br>';
echo '文件大小(字节):'.$_FILES['upfile']['size'] . '<br>';
}
else
{
echo '移动文件:'.$_FILES['upfile']['name'] . '失败<br>';
}
}
else
{
echo '上传出错:'.$_FILES['upfile']['error'] . '<br>';
}
}
?>
<form method="post" action="" enctype="multipart/form-data">
<input type="file" name="upfile"><br>
<input type="submit">
</form>
</body>
</html>
array
'upfile' =>
array
'name' => string 'cakephp-1.3.21.zip' (length=18)
'type' => string 'application/x-zip-compressed' (length=28)
'tmp_name' => string 'D:\wamp\tmp\php8CCC.tmp' (length=23)
'error' => int 0
'size' => int 1516642
boolean true
上传成功:cakephp-1.3.21.zip
文件大小(字节):1516642