<?php
//判斷錯誤碼
require("upload.html");
if( $_FILES['file']['error']>0){
# switch($_FILES['file']['error']){
# case '1':
echo '檔案過大';
break;
## '; break;# case '3': case '4': echo '檔案沒有上傳」; break; 1 case '6': 10ase '6'#資料夾'; break; case '7': # default: echo '上傳出錯</br>'; } }else{ if( $_FILES['file']['size']>200000){# exit("檔案超出指定大小"); }# //判斷檔案後綴名 $allowsuffix = array('png','jpg','jpeg'); $filename = explode(' .',$_FILES['file']['name']); $filesuffix = array_pop($filename); if(!in_array($filesuffix,$allowsuffix)) { exit("檔案字尾不正確"); }# $allowmine = array( "image/ png", "image/jpg", "image/jpeg", "image/pjpeg", "image/gif" , ); if(!in_array($_FILES['file']['name'],$allowmine)){ exit("檔案格式不正確"); } //指定上傳檔案路徑 $path = "d:/phpstudy/ PHPtutorial/www/upload/image/"; $newname = date('YmdHis').rand(0,9).'.'.$filesuffix;# $filepath = $ path.$newname; if(is_uploaded_file($_FILES['file']['tmp_name'])){ if(move_uploaded_file($_FILES['file']['tmp_name '],$filepath)){ echo "上傳成功"; }else{ echo"上傳失敗"; } }else{ echo"上傳錯誤"; }# }?> ;
陣列最後一個多了個,
沒聽懂,報什麼錯呢? 51行