diff --git a/commands/http/client.go b/commands/http/client.go index 3da268ffee9..2332142e73c 100644 --- a/commands/http/client.go +++ b/commands/http/client.go @@ -96,7 +96,6 @@ func (c *client) Send(req cmds.Request) (cmds.Response, error) { // TODO extract string consts? if fileReader != nil { httpReq.Header.Set(contentTypeHeader, "multipart/form-data; boundary="+fileReader.Boundary()) - httpReq.Header.Set(contentDispHeader, "form-data: name=\"files\"") } else { httpReq.Header.Set(contentTypeHeader, applicationOctetStream) } diff --git a/commands/http/multifilereader.go b/commands/http/multifilereader.go index 4a564176a3e..1df121211e0 100644 --- a/commands/http/multifilereader.go +++ b/commands/http/multifilereader.go @@ -92,12 +92,7 @@ func (mfr *MultiFileReader) Read(buf []byte) (written int, err error) { // write the boundary and headers header := make(textproto.MIMEHeader) filename := url.QueryEscape(file.FileName()) - if mfr.form { - contentDisposition := fmt.Sprintf("form-data; name=\"file\"; filename=\"%s\"", filename) - header.Set("Content-Disposition", contentDisposition) - } else { - header.Set("Content-Disposition", fmt.Sprintf("file; filename=\"%s\"", filename)) - } + header.Set("Content-Disposition", fmt.Sprintf("file; filename=\"%s\"", filename)) header.Set("Content-Type", contentType) diff --git a/mfs/ops.go b/mfs/ops.go index fc36b2256d3..a7b464db376 100644 --- a/mfs/ops.go +++ b/mfs/ops.go @@ -89,6 +89,10 @@ func lookupDir(r *Root, path string) (*Directory, error) { // PutNode inserts 'nd' at 'path' in the given mfs func PutNode(r *Root, path string, nd *dag.Node) error { dirp, filename := gopath.Split(path) + err := Mkdir(r, dirp, true) + if err != nil { + return err + } pdir, err := lookupDir(r, dirp) if err != nil {