|
@ -4,12 +4,10 @@ import ( |
|
|
"bytes" |
|
|
"bytes" |
|
|
"encoding/json" |
|
|
"encoding/json" |
|
|
"errors" |
|
|
"errors" |
|
|
"path/filepath" |
|
|
|
|
|
_ "fmt" |
|
|
_ "fmt" |
|
|
"io" |
|
|
"io" |
|
|
"io/ioutil" |
|
|
"io/ioutil" |
|
|
"log" |
|
|
"log" |
|
|
"mime" |
|
|
|
|
|
"mime/multipart" |
|
|
"mime/multipart" |
|
|
"net/http" |
|
|
"net/http" |
|
|
) |
|
|
) |
|
@ -31,7 +29,6 @@ func Upload(uploadUrl string, filename string, reader io.Reader) (*UploadResult, |
|
|
log.Println("error copying data", err) |
|
|
log.Println("error copying data", err) |
|
|
return nil, err |
|
|
return nil, err |
|
|
} |
|
|
} |
|
|
content_type := mime.TypeByExtension(filepath.Ext(filename)) |
|
|
|
|
|
content_type := body_writer.FormDataContentType() |
|
|
content_type := body_writer.FormDataContentType() |
|
|
if err = body_writer.Close(); err != nil { |
|
|
if err = body_writer.Close(); err != nil { |
|
|
log.Println("error closing body", err) |
|
|
log.Println("error closing body", err) |
|
|