表单上传文件无法显示,这是我的表单上传代码
<?php
$imageinfo = getimagesize($_FILES['img']['tmp_name']);
if($imageinfo['mime'] != 'image/gif' && $imageinfo['mime'] != 'image/jpeg') {
echo "<center><br>Sorry, we only accept GIF and JPEG images</br><br>param name: img<br>u can upload
with CSRF";
exit;
}
$uploaddir = 'ex/';
$uploadfile = $uploaddir . basename($_FILES['img']['name']);
if (move_uploaded_file($_FILES['img']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "File uploading failed.\n";
}?>
<form action="" method="post" enctype="multipart/form-data">
<input type="file" size="20" name="img" />
<input type="submit" name="upload" value="Upload" />
</form>
结果是
Sorry, we only accept GIF and JPEG images
param name: img
u can upload with CSRF
我想显示表单上传文件
哈士奇WWW