我有以下
$name = basename($_FILES['the_file']['name']);
$size = $_FILES['the_file']['size'];
$contents = $_FILES['the_file']['tmp_name'];
if($size <= 5242880 && is_uploaded_file($_FILES['the_file']['tmp_name'])) {
$picture = file_get_contents($contents);
echo $picture;
}
但没有任何回应。我在这里做错了吗?
修改
我改变了我的代码:
$name = basename($_FILES['the_file']['name']);
$size = $_FILES['the_file']['size'];
$contents = $_FILES['the_file']['tmp_name'];
if($size <= 5242880) {
$picture = file_get_contents($contents);
echo $picture;
}
我删除了is_uploaded_file()
条件,现在说
Warning: file_get_contents() [function.file-get-contents]: Filename cannot be empty in /home/*************.php on line 13
(我模糊了路径)
表示该文件未上传。有什么想法吗?
答案 0 :(得分:0)
也许你已经从表单中遗漏了enctype
?
<form action='...' method='POST' enctype='multipart/form-data'>