mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
34 lines
442 B
V
34 lines
442 B
V
module main
|
|
|
|
import vweb
|
|
|
|
const (
|
|
port = 8082
|
|
)
|
|
|
|
struct App {
|
|
vweb.Context
|
|
}
|
|
|
|
fn main() {
|
|
vweb.run<App>(port)
|
|
}
|
|
|
|
pub fn (mut app App) index() vweb.Result {
|
|
return $vweb.html()
|
|
}
|
|
|
|
[post]
|
|
['/upload']
|
|
pub fn (mut app App) upload() vweb.Result {
|
|
fdata := app.files['upfile']
|
|
|
|
mut files := []vweb.RawHtml{}
|
|
|
|
for d in fdata {
|
|
files << d.data.replace_each(['\n', '<br>', '\n\r', '<br>' '\t', ' ', ' ', ' '])
|
|
}
|
|
|
|
return $vweb.html()
|
|
}
|