aboutsummaryrefslogtreecommitdiff
path: root/go/weed/upload.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2013-07-11 22:45:29 -0700
committerChris Lu <chris.lu@gmail.com>2013-07-11 22:45:29 -0700
commitb0e5112702a879537602d56dd69449fab923bcb6 (patch)
treedb47298f81d18872313f09de4e633986619ca4d4 /go/weed/upload.go
parent4c1bc99366831718fdbf6a02ed3fb5a81cce0e77 (diff)
downloadseaweedfs-b0e5112702a879537602d56dd69449fab923bcb6.tar.xz
seaweedfs-b0e5112702a879537602d56dd69449fab923bcb6.zip
"weed upload" return message changes
Diffstat (limited to 'go/weed/upload.go')
-rw-r--r--go/weed/upload.go19
1 files changed, 11 insertions, 8 deletions
diff --git a/go/weed/upload.go b/go/weed/upload.go
index 96b326a39..89560a12f 100644
--- a/go/weed/upload.go
+++ b/go/weed/upload.go
@@ -67,11 +67,11 @@ func upload(filename string, server string, fid string) (int, error) {
return 0, err
}
fi, fiErr := fh.Stat()
- if fiErr!=nil {
- debug("Failed to stat file:", filename)
- return 0, fiErr
+ if fiErr != nil {
+ debug("Failed to stat file:", filename)
+ return 0, fiErr
}
- ret, e := operation.Upload("http://"+server+"/"+fid+"?ts="+strconv.Itoa(int(fi.ModTime().Unix()) ), path.Base(filename), fh)
+ ret, e := operation.Upload("http://"+server+"/"+fid+"?ts="+strconv.Itoa(int(fi.ModTime().Unix())), path.Base(filename), fh)
if e != nil {
return 0, e
}
@@ -79,9 +79,11 @@ func upload(filename string, server string, fid string) (int, error) {
}
type SubmitResult struct {
- Fid string `json:"fid"`
- Size int `json:"size"`
- Error string `json:"error"`
+ FileName string `json:"fileName"`
+ FileUrl string `json:"fileUrl"`
+ Fid string `json:"fid"`
+ Size int `json:"size"`
+ Error string `json:"error"`
}
func submit(files []string) []SubmitResult {
@@ -101,13 +103,14 @@ func submit(files []string) []SubmitResult {
fid = ""
results[index].Error = err.Error()
}
+ results[index].FileName = file
results[index].Fid = fid
+ results[index].FileUrl = ret.PublicUrl + "/" + fid
}
return results
}
func runUpload(cmd *Command, args []string) bool {
- *IsDebug = true
if len(cmdUpload.Flag.Args()) == 0 {
return false
}