Commit 5df16ec0 authored by Sonja Happ's avatar Sonja Happ
Browse files

change name and type of file upon update

parent c4d7fc94
......@@ -118,9 +118,14 @@ func (f *File) update(fileHeader *multipart.FileHeader) error {
defer fileContent.Close()
db := database.GetDB()
err = db.Model(f).Updates(map[string]interface{}{"Size": fileHeader.Size,
err = db.Model(f).Updates(map[string]interface{}{
"Size": uint(fileHeader.Size),
"FileData": fileData,
"Date": time.Now().String()}).Error
"Date": time.Now().String(),
"Name": filepath.Base(fileHeader.Filename),
"Type": fileHeader.Header.Get("Content-Type"),
}).Error
return err
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment