Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsAllowExtension ¶
IsAllowExtension checks if a given file's extension is allowed based on a provided list of acceptable extensions.
func RemoveExifMetadata ¶ added in v0.0.2
RemoveExifMetadata returns error if something went wrong during the exif metadata removal process, functions takes inputPath which is location of the image. purpose of this function is that to open and re-encode image without metadata
func RemoveUploadedFile ¶
RemoveUploadedFile removes uploaded file from uploaded directory and returns error if something went wrong, it takes upload directory and fileName. Use this function in your handler after file is uploaded
Types ¶
type File ¶
type File struct { // Original uploaded file name FileName string // FileUniqueName is unique name FileUniqueName string // Uploaded file path FilePath string // Uploaded file extension FileExtension string // Uploaded file size FileSize string }
File struct is final face of uploaded file, it includes necessary field to use them after file is uploaded
func StoreChunk ¶
func StoreChunk(r *RFileRequest) (*File, error)
StoreChunk cares slice of chunks and returns final results and error. Functions creates new directory for chunks if it doesn't exist, if directory already exists it appends received chunks in current chunks and if entire file is uploaded then File struct is returned
type RFileRequest ¶
type RFileRequest struct { // File is an interface to access the file part of a multipart message. File multipart.File // A FileHeader describes a file part of a multipart request. UploadFile *multipart.FileHeader // Maximum range of chunk uploads MaxRange int // Uploaded file size FileSize int // Upload directory UploadDirectory string // FileUniqueName is identifier to generate unique name for files FileUniqueName bool }
RFileRequest struct is used for http request, use this struct to bind uploaded file