我用move_uploaded_file移动文件后,文件名变成乱码!请高手指点!
运行环境是:windows xp + wamp以下是源码:<?phpheader('Content-Type:text/html;charset=utf-8');
$uploaddir = 'F:/psite/test/img/';
$arrSuffix = array('jpeg', 'jpg');if(isset($_FILES['file_upload'])){
$uploadfile = $uploaddir . basename($_FILES['file_upload']['name']);
echo $uploadfile . '<br />';
if($_FILES['file_upload']['error'] == 2){
echo '文件起过最大允许的大小!';
exit;
}

$name = $_FILES['file_upload']['name'];
if(is_file($name)){
$arrElement = explode($name);
$suffix = $arrElement[count($arrElement)-1];

if(array_search($suffix, $arrSuffix)){
echo '支持您上传的文件<br />';
}
else{
echo '你上传的文件不支持';
eixt;
}
}


if (move_uploaded_file($_FILES['file_upload']['tmp_name'], $uploadfile )) {
    echo "上传成功!<br />";
} else {
    echo "上传失败!!\n";
}
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title></title>
</head>
<body>
<form action="" method="post" enctype="multipart/form-data" >
<input type="hidden" name="MAX_FILE_SIZE" value="200000" />
<input type="file" name="file_upload" id="file_upload" />
<input type="submit" value="submit" />
</form>
<?php
if(isset($_GET['action']) && $_GET['action'] == 'view'){
$d = dir($uploaddir);
while(false !== ($entry = $d->read())){
$arrElement = explode('.', $entry);
$suffix = $arrElement[count($arrElement)-1];
if(array_search($suffix, $arrSuffix)){
echo '<img width="80" height="80" style="margin-right:2px;" src="./img/' . $entry . '"/>';
}
}
}
?>
<a href="upload_file.php?action=view">查看图片</a>
</body>
</html>