Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Default maximum file size (100MB) DefaultMaxFileSize int64 = 100 * 1024 * 1024 // Allowed file formats AllowedFileFormats = map[string]bool{ ".jpg": true, ".jpeg": true, ".png": true, ".gif": true, ".webp": true, ".bmp": true, ".tiff": true, ".svg": true, ".pdf": true, ".xls": true, ".xlsx": true, ".ppt": true, ".pptx": true, ".sql": true, ".wav": true, ".mp3": 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, "application/vnd.ms-excel": true, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": true, "application/vnd.ms-powerpoint": true, "application/vnd.openxmlformats-officedocument.presentationml.presentation": true, "text/plain": true, "application/sql": true, "audio/wav": true, "audio/wave": true, "audio/mpeg": true, "audio/mp3": true, } )
Functions ¶
func ValidateFile ¶
func ValidateFile(file *multipart.FileHeader) error
ValidateFile performs file validation
func ValidateFileContent ¶
ValidateFileContent validates file content
func ValidateStruct ¶
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.