diff options
author | Wolfy-J <[email protected]> | 2018-06-15 15:54:14 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-06-15 15:54:14 +0300 |
commit | dfef39c64132192d13e2315364a74f1b0244791e (patch) | |
tree | b0959bbbb1ca5a16d94646454d7f2e9340081915 /service/http/uploads.go | |
parent | ccd297dbe2586b3fd29854f72f795be9e818522e (diff) |
readme, samples, golint, build scripts
Diffstat (limited to 'service/http/uploads.go')
-rw-r--r-- | service/http/uploads.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/service/http/uploads.go b/service/http/uploads.go index 4607dea4..9b205f00 100644 --- a/service/http/uploads.go +++ b/service/http/uploads.go @@ -10,23 +10,23 @@ import ( ) const ( - // There is no error, the file uploaded with success. + // UploadErrorOK - no error, the file uploaded with success. UploadErrorOK = 0 - // No file was uploaded. + // UploadErrorNoFile - no file was uploaded. UploadErrorNoFile = 4 - // Missing a temporary folder. + // UploadErrorNoTmpDir - missing a temporary folder. UploadErrorNoTmpDir = 5 - // Failed to write file to disk. + // UploadErrorCantWrite - failed to write file to disk. UploadErrorCantWrite = 6 - // Forbid file extension. + // UploadErrorExtension - forbidden file extension. UploadErrorExtension = 7 ) -// tree manages uploaded files tree and temporary files. +// Uploads tree manages uploaded files tree and temporary files. type Uploads struct { // associated temp directory and forbidden extensions. cfg *UploadsConfig @@ -99,6 +99,7 @@ func NewUpload(f *multipart.FileHeader) *FileUpload { } } +// Open moves file content into temporary file available for PHP. func (f *FileUpload) Open(cfg *UploadsConfig) error { if cfg.Forbids(f.Name) { f.Error = UploadErrorExtension |