[請益] 關於檔案類型

看板PHP作者 (小天使落跑了!!??)時間20年前 (2006/02/04 10:48), 編輯推噓3(301)
留言4則, 3人參與, 最新討論串1/1
if (($Picture_type == "application/x-zip-compressed") || ($Picture_type == "application/msword")) { 以上是小弟找到的上傳程式的片段, 也就是只能上傳zip和doc檔 小弟想將此程式修改為所有檔案類型均可以上傳 請問要如何修改呢? 後來也搜尋到一些相關資訊如下 但是我改了老半天,似乎都起不了作用 我對程式很外行 $registered_types = array( "application/x-gzip-compressed" => ".tar.gz, .tgz", "application/x-zip-compressed" => ".zip", "application/x-tar" => ".tar", "text/plain" => ".html, .php, .txt, .inc (etc)", "image/bmp" => ".bmp, .ico", "image/gif" => ".gif", "image/pjpeg" => ".jpg, .jpeg", "image/jpeg" => ".jpg, .jpeg", "application/x-shockwave-flash" => ".swf", "application/msword" => ".doc", "application/vnd.ms-excel" => ".xls", "application/octet-stream" => ".exe, .fla (etc)" ); ?> -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.64.151.44

02/04 11:26, , 1F
所有檔案都可以上傳不就是不要用判斷式就可以了嗎?
02/04 11:26, 1F

02/04 11:41, , 2F
是沒錯呀...只是我不知道怎麼修改QQ
02/04 11:41, 2F

02/05 00:50, , 3F
1樓說的沒錯,你把那個if判斷式拿掉試試看
02/05 00:50, 3F

02/05 00:51, , 4F
下面的關聯陣列只是用來顯示檔案類型的資訊用的
02/05 00:51, 4F
文章代碼(AID): #13v1NttE (PHP)
文章代碼(AID): #13v1NttE (PHP)