Documentation
¶
Index ¶
Constants ¶
View Source
const ( MD5 = "md5" SHA1 = "sha1" SHA256 = "sha256" SHA512 = "sha512" )
Variables ¶
This section is empty.
Functions ¶
func HashReader ¶
流式哈希,alg为"md5"|"sha1"|"sha256"|"sha512"
func SaveFile ¶
func SaveFile(fileHeader *multipart.FileHeader, dstPath, fileType, expectedHash string) error
SaveFile 保存上传的文件 增加了严格的安全校验 参数: fileHeader *multipart.FileHeader: 上传的文件 dstPath string: 文件保存的目标路径 fileType: 文件类型, 如 "application/zip",可以为空,表示不进行文件类型校验 expectedHash string: 预期的文件的哈希值,用于严格校验,为空表示不进行校验
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.