Save uploaded file to uploads dir
This commit is contained in:
parent
2136a86d55
commit
ba70330b70
|
@ -51,7 +51,13 @@ get '/', -> $request, $response {
|
|||
};
|
||||
|
||||
post '/', -> $request, $response {
|
||||
dd $request.content;
|
||||
my Str $filename =
|
||||
$request.content<file><filename> ~
|
||||
'.' ~
|
||||
$request.content<file><headers><content-type>.split('/')[1];
|
||||
my Buf $file-body = $request.content<file><body>;
|
||||
|
||||
('uploads/' ~ $filename).IO.spurt: $file-body;
|
||||
|
||||
$response.redirect('/');
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue