Skip to content

Commit

Permalink
[Upload] Cleanup some code and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
git001 committed May 16, 2023
1 parent 3665b95 commit f72078c
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,6 @@ func (u *Upload) Provision(ctx caddy.Context) error {
zap.String("msg", "no Root Directory specified (root_dir), will use {http.vars.root}"))
}

mdall_err := os.MkdirAll(u.DestDir, 0755)
if mdall_err != nil {
u.logger.Error("Provision",
zap.String("msg", "MkdirAll: Error creating destination Directory"),
zap.Error(mdall_err))
return mdall_err
}

if u.FileFieldName == "" {
u.logger.Warn("Provision",
zap.String("msg", "no FileFieldName specified (file_field_name), using the default one 'myFile'"),
Expand Down Expand Up @@ -277,7 +269,6 @@ func (u Upload) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp

// read all of the contents of our uploaded file into a
// byte array
//fileBytes, io_err := ioutil.ReadAll(file)
fileBytes, io_err := io.Copy(tempFile, file)
if io_err != nil {
u.logger.Error("Copy Error",
Expand All @@ -287,8 +278,6 @@ func (u Upload) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp
zap.Object("request", caddyhttp.LoggableHTTPRequest{Request: r}))
return caddyhttp.Error(http.StatusInternalServerError, io_err)
}
// write this byte array to our temporary file
//tempFile.Write(fileBytes)

u.logger.Info("Successful Upload Info",
zap.String("requuid", requuid),
Expand Down

0 comments on commit f72078c

Please sign in to comment.