Store files on GridFS
This commit is contained in:
parent
64375b6de5
commit
05b641201c
8 changed files with 94 additions and 75 deletions
3
admin.go
3
admin.go
|
@ -235,13 +235,12 @@ func storeHandler(w http.ResponseWriter, r *http.Request) {
|
|||
continue
|
||||
}
|
||||
book := books[0]
|
||||
path, err := StoreBook(book)
|
||||
if err != nil {
|
||||
sess.Notify("An error ocurred!", err.Error(), "error")
|
||||
log.Println("Error storing book '", book.Title, "': ", err.Error())
|
||||
continue
|
||||
}
|
||||
db.UpdateBook(id, bson.M{"active": true, "path": path})
|
||||
db.UpdateBook(id, bson.M{"active": true})
|
||||
titles = append(titles, book.Title)
|
||||
}
|
||||
if titles != nil {
|
||||
|
|
Reference in a new issue