2021-01-21 13:08:51 +03:00
|
|
|
module main
|
|
|
|
|
|
|
|
import vweb
|
|
|
|
|
|
|
|
const (
|
|
|
|
port = 8082
|
|
|
|
)
|
|
|
|
|
|
|
|
struct App {
|
|
|
|
vweb.Context
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2021-05-11 11:10:35 +03:00
|
|
|
vweb.run(&App{}, port)
|
2021-01-21 13:08:51 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn (mut app App) index() vweb.Result {
|
|
|
|
return $vweb.html()
|
|
|
|
}
|
|
|
|
|
2021-04-20 17:16:35 +03:00
|
|
|
['/upload'; post]
|
2021-01-21 13:08:51 +03:00
|
|
|
pub fn (mut app App) upload() vweb.Result {
|
|
|
|
fdata := app.files['upfile']
|
|
|
|
|
|
|
|
mut files := []vweb.RawHtml{}
|
|
|
|
|
|
|
|
for d in fdata {
|
2021-04-20 17:16:35 +03:00
|
|
|
files << d.data.replace_each(['\n', '<br>', '\n\r', '<br>', '\t', ' ', ' ', ' '])
|
2021-01-21 13:08:51 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return $vweb.html()
|
|
|
|
}
|