Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Default maximum file size (25MB) DefaultMaxFileSize int64 = 25 * 1024 * 1024 // Allowed file formats AllowedImageFormats = map[string]bool{ ".jpg": true, ".jpeg": true, ".png": true, ".gif": true, ".webp": true, ".bmp": true, ".tiff": true, ".svg": true, } // Allowed MIME types AllowedMimeTypes = map[string]bool{ "image/jpeg": true, "image/png": true, "image/gif": true, "image/webp": true, "image/bmp": true, "image/tiff": true, "image/svg+xml": true, "application/pdf": true, } )
Functions ¶
func ValidateFile ¶
func ValidateFile(file *multipart.FileHeader) error
ValidateFile performs file validation
func ValidateFileContent ¶
ValidateFileContent validates file content
func ValidateStruct ¶
func ValidateStruct(s interface{}) error
ValidateStruct validates a struct using validator tags
Types ¶
type FileValidationError ¶
FileValidationError custom error type
func (*FileValidationError) Error ¶
func (e *FileValidationError) Error() string
Click to show internal directories.
Click to hide internal directories.