我无法理解为什么下面的代码会给我这个错误: 严格标准:只应在第8行的/web/htdocs/www.mywebsite.com/admin/post/upload.php中通过引用传递变量
无论如何,结果是成功的! (它给了我"成功"并且实际上有效) 我怎么能解决它?
对不起我的英文,提前谢谢你!
第8行是: $ file_ext =用strtolower(端(爆炸('',$ _ FILES ['图像'] ['名称'])));
整个代码是:
<?php
if(isset($_FILES['image'])){
$errors= array();
$file_name = $_FILES['image']['name'];
$file_size = $_FILES['image']['size'];
$file_tmp = $_FILES['image']['tmp_name'];
$file_type = $_FILES['image']['type'];
$file_ext=strtolower(end(explode('.',$_FILES['image']['name'])));
$expensions= array("jpeg","jpg","png","pdf");
if(in_array($file_ext,$expensions)=== false){
$errors[]="Error. Supported formats: JPG, JPEG, PNG, PDF";
}
if($file_size > 999999999) {
$errors[]='File too large';
}
if(empty($errors)==true) {
move_uploaded_file($file_tmp,"../../../sources/".$file_name);
echo "Success";
}else{
print_r($errors);
}
}
?>
<html>
<body>
<form action = "" method = "POST" enctype = "multipart/form-data">
<input type = "file" name = "image" />
<input type = "submit"/>
<ul>
<li>Filename: /press/sources/<?php echo $_FILES['image']['name']; ?>
<li>Size: <?php echo $_FILES['image']['size']; ?>
<li>Format: <?php echo $_FILES['image']['type'] ?>
</ul>
</form>
</body>
</html>