文件上传数据库

This commit is contained in:
2025-07-09 21:34:52 +08:00
parent b9b53fdee7
commit b0924f8a7d
5 changed files with 71 additions and 45 deletions
+4 -24
View File
@@ -1,26 +1,6 @@
package models
//mime信息转换位拓展名
var Mime_to_extname = map[string]string{
"image/jpeg": ".jpeg",
"image/png": ".png",
"image/gif": ".gif",
"image/bmp": ".bmp",
"video/mp4": ".mp4",
"video/x-msvideo": ".",
"video/quicktime": ".",
"video/x-flv": ".flv",
"video/mpeg": ".mpeg",
"audio/mpeg": ".mp3",
"audio/aac": ".acc",
"audio/wav": ".wav",
"audio/flac": ".flac",
"application/pdf": ".pdf",
}
type Configs_web_t struct {
Host string `mapstructure:"host"`
@@ -41,8 +21,8 @@ type Configs_user_t struct {
type Configs_file_t struct {
Max_size uint64 `mapstructure:"max_size"`
Pahts map[string]string `mapstructure:"pahts"`
Allow_image_mime map[string]bool `mapstructure:"allow_image_mime"`
Allow_video_mime map[string]bool `mapstructure:"allow_video_mime"`
Allow_music_mime map[string]bool `mapstructure:"allow_music_mime"`
Allow_pdf_mime map[string]bool `mapstructure:"allow_pdf_mime"`
Allow_image_mime map[string]string `mapstructure:"allow_image_mime"`
Allow_video_mime map[string]string `mapstructure:"allow_video_mime"`
Allow_music_mime map[string]string `mapstructure:"allow_music_mime"`
Allow_pdf_mime map[string]string `mapstructure:"allow_pdf_mime"`
}