Documentation
¶
Index ¶
- Variables
- func ServeFileForDownload(w http.ResponseWriter, r *http.Request, filePath string, opts DownloadOptions) error
- type DownloadOptions
- type FileUploadOptions
- type SavedFile
- func SaveMultipleFormFiles(r *http.Request, fieldName string, opts *FileUploadOptions) ([]*SavedFile, error)
- func SaveSingleFormFile(r *http.Request, fieldName string, opts *FileUploadOptions) (*SavedFile, error)
- func SaveUploadedFile(file *multipart.FileHeader, opts *FileUploadOptions) (*SavedFile, error)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ServeFileForDownload ¶
func ServeFileForDownload(w http.ResponseWriter, r *http.Request, filePath string, opts DownloadOptions) error
ServeFileForDownload serves a file for download with the specified options
Types ¶
type DownloadOptions ¶
type DownloadOptions struct {
ForceDownload bool
SuggestedFilename string
ContentType string
ExtraHeaders map[string]string
}
func DefaultDownloadOptions ¶
func DefaultDownloadOptions() DownloadOptions
type FileUploadOptions ¶
type FileUploadOptions struct {
DestinationDir string
MaxSize int64
// AllowedExts is a list of allowed file extensions (without the dot). Leave empty to allow all.
AllowedExts []string
AllowedMimeTypes []string
FilenamePrefix string
RandomizeFilename bool
}
func DefaultOptions ¶
func DefaultOptions() FileUploadOptions
type SavedFile ¶
type SavedFile struct {
OriginalName string
SavedName string
SavedPath string
Size int64
MIMEType string
}
func SaveMultipleFormFiles ¶
func SaveSingleFormFile ¶
func SaveUploadedFile ¶
func SaveUploadedFile(file *multipart.FileHeader, opts *FileUploadOptions) (*SavedFile, error)
Click to show internal directories.
Click to hide internal directories.