fix:文件上传--base64
This commit is contained in:
17
utils/file/base64.go
Normal file
17
utils/file/base64.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package file
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func FileBase64ToByte(fileData string) ([]byte, error) {
|
||||
RBase64Point := strings.LastIndex(fileData, ";base64,") + 8
|
||||
fileDataStr := fileData[RBase64Point:]
|
||||
dist, err := base64.StdEncoding.DecodeString(fileDataStr)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dist, nil
|
||||
}
|
||||
Reference in New Issue
Block a user