if(isset($_FILES['avatar']) && !empty($_FILES['avatar']['name'])){
if($_FILES['avatar']['type'] != "image/gif" || $_FILES['avatar']['type'] != "image/jpeg" || $_FILES['avatar']['type'] != "image/jpg" || $_FILES['avatar']['type'] != "image/pjpeg" || $_FILES['avatar']['type'] != "image/x-png" || $_FILES['avatar']['type'] != "image/png"){
$errors[] = 'File does not have the right mime type.';
$errors[] = '(This avatar has the mime type '. $_FILES['avatar']['type'] .')';
}
if($_FILES['avatar']['size'] > 40960){
$errors[] = 'File is too large, max 40 kb.';
$errors[] = 'This is '. $_FILES['avatar']['size'];
}
}
你好再次stackoverflow!
我让我的用户在注册时决定他们是想立即上传他们的头像,还是稍后再上传。
我目前正在尝试的是上传一个 800b 的 gif 文件。但是在上传时,我收到文件与允许的 mime 类型不匹配的错误。我在这里做什么?