add "weed copy" command to copy files to filer

This commit is contained in:
Chris Lu
2016-07-20 23:45:55 -07:00
parent 40ba6d2a6f
commit cdae9fc680
8 changed files with 217 additions and 10 deletions

View File

@@ -27,3 +27,15 @@ func (fs *FilerServer) moveHandler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}
}
func (fs *FilerServer) registerHandler(w http.ResponseWriter, r *http.Request) {
path := r.FormValue("path")
fileId := r.FormValue("fileId")
err := fs.filer.CreateFile(path, fileId)
if err != nil {
glog.V(4).Infof("register %s to %s error: %v", fileId, path, err)
writeJsonError(w, r, http.StatusInternalServerError, err)
} else {
w.WriteHeader(http.StatusOK)
}
}