Save uploaded file to uploads dir

This commit is contained in:
swagg boi 2023-11-10 00:25:28 -05:00
parent 2136a86d55
commit ba70330b70

View file

@ -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('/');
};