// Add a new block to a structured file. The name of the block // is in the parameter "block", the content is as before in "data" func blockAddFunc(w http.ResponseWriter, r *http.Request, filesys *fs.RootFileSystem) { fileNode, dirNode, err := filesys.GetFileOrDirectory(r.URL.Path, true) if err != nil { writeError(w, err) } else if dirNode != nil { writeError(w, errors.New("Cannot add to a directory")) } else { // We have a filenode... filesys.SaveNewBlock(r.URL.Path, fileNode, r.Form["block"][0], []byte(r.Form["data"][0]), true) getFunc(w, r, filesys) } }