明明下传了图片,判断图片图型时不通过

WBOY
Release: 2016-06-13 12:53:50
Original
619 people have browsed it

明明上传了图片,判断图片图型时不通过。
下面的代码,
我上传图片,
总是显示:
出错.
请问这个判断语句,
错了?
请详细一些。
谢谢

<br />
<br />
<br />
	if ((($_FILES['logo_file1']['type'] == "image?gif")<br />
			|| ($_FILES['logo_file1']['type'] == "image?jpeg")<br />
			|| ($_FILES['logo_file1']['type'] == "image?jpg")<br />
			|| ($_FILES['logo_file1']['type'] == "image?pjpeg"))<br />
		 && ($_FILES['logo_file1']['size'] < 10485760)) {<br />
<br />
		echo "上传图片.";<br />
<br />
	} else {<br />
		echo "出错.";<br />
	}<br />
<br />
<br />
Copy after login


------解决方案--------------------
<br />
if ((($_FILES["file"]["type"] == "image/gif")<br />
		<br><font color='#FF8000'>------解决方案--------------------</font><br> ($_FILES["file"]["type"] == "image/jpeg")<br />
		<br><font color='#FF8000'>------解决方案--------------------</font><br> ($_FILES["file"]["type"] == "image/pjpeg"))<br />
		&& ($_FILES["file"]["size"] < 20000)){ <br />
	     echo "上传图片."; }else {<br />
		 echo "出错."; }  <br />
<br />
<br />
Copy after login

正确代码,帮你试好了,用"",别用''
------解决方案--------------------
1.先把所有类型判断去掉(剩下字节数),看看还会不会出错
2.然后只添上gif一种类型判断,看看还会不会出错

如果1.正确,2.错误,要考究下你的php文件编码

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!