我有两个文件,upload.php:
<?php
$validExt=array("txt","xml");
$ext=end(explode(".", $_FILES['file']['name']));
if(($_FILES['file']['type']=='text/plain') ||($_FILES['file']['type']=='text/xml')&&($_FILES['file']['size']<1000)&& in_array($ext,$validExt)){
if($_FILES['file']['error']>0){
echo "ERROR!";
}else{
echo "Name: ".$_FILES['file']['name']."<br>";
echo "Type: ".$_FILES['file']['type']."<br>";
echo "Size: ".$_FILES['file']['size']."<br>";
echo "Tmp name: ".$_FILES['file']['tmp_name']."<br>";
}
}else{
echo "wrong file!";
}
?>
第二个是index.html:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
</head>
<body>
<form enctype="multipart/form-data" action="upload.php" method="post">
<input name="file" type="file"/>
<input type="submit" value="Wyslij" />
</form>
</body>
</html>
当我尝试上传文件时,我收到错误和答案。 错误: 严格的标准:只有变量才能在第4行的D:\ wamp \ www \ php_z \ upload \ upload.php中通过引用传递
我是php的初学者,但是有人可以解释一下如何解决这个问题吗?