我有一个非常简单的照片上传器,需要一些提高速度
首先,即使框中没有任何内容,页面加载时也会出现回声?
if($_POST['upload']) {
if($_FILES['image']['name'] == "")
{
#there's no file name return an error
echo "\n<b>Please select a file to upload!\n</b>";
exit;
}
#we have a filename, continue
}
#directory to upload to
$uploads = '/home/habbonow/public_html/other/quacked/photos';
$usruploads = 'photos';
#allowed file types
$type_array = array('image/gif','image/pjpeg','image/x-png');
if(!in_array($_FILES['image']['type'], $type_array))
{
#the type of the file is not in the list we want to allow
echo "\n<b>That file type is not allowed!\n</b>";
exit;
}
页面输出显示上传框,但也回显“不允许该文件类型!” 即使我没有点击按钮。
其次,什么是 jpg 的 mime 类型,因为我有 jpeg 和 pjpeg。
谢谢,任何帮助表示赞赏。