获取允许的商城文件的类型.
()
| 111 | |
| 112 | //获取允许的商城文件的类型. |
| 113 | func GetUploadFileExt() []string { |
| 114 | ext := beego.AppConfig.DefaultString("upload_file_ext", "png|jpg|jpeg|gif|txt|doc|docx|pdf") |
| 115 | |
| 116 | temp := strings.Split(ext, "|") |
| 117 | |
| 118 | exts := make([]string, len(temp)) |
| 119 | |
| 120 | i := 0 |
| 121 | for _, item := range temp { |
| 122 | if item != "" { |
| 123 | exts[i] = item |
| 124 | i++ |
| 125 | } |
| 126 | } |
| 127 | return exts |
| 128 | } |
| 129 | |
| 130 | //判断是否是允许商城的文件类型. |
| 131 | func IsAllowUploadFileExt(ext string, typ ...string) bool { |
no outgoing calls
no test coverage detected