Provide different output methods
git-svn-id: file:///srv/svn/repo/marisa/trunk@45 d6811dac-2434-b64a-9ddc-f563ab233461
This commit is contained in:
@@ -203,11 +203,14 @@ func uploaderPost(w http.ResponseWriter, r *http.Request) {
|
|||||||
links = append(links, link)
|
links = append(links, link)
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.PostFormValue("output") == "html" {
|
switch r.PostFormValue("output") {
|
||||||
|
case "html":
|
||||||
data := templatedata{Links: links}
|
data := templatedata{Links: links}
|
||||||
servetemplate(w, "/upload.html", data)
|
servetemplate(w, "/upload.html", data)
|
||||||
return
|
case "json":
|
||||||
} else {
|
data, _ := json.Marshal(links)
|
||||||
|
w.Write(data)
|
||||||
|
default:
|
||||||
for _, link := range links {
|
for _, link := range links {
|
||||||
w.Write([]byte(link + "\r\n"))
|
w.Write([]byte(link + "\r\n"))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user