diff --git a/Handler/Upload.hs b/Handler/Upload.hs index c3d130b..cba2808 100644 --- a/Handler/Upload.hs +++ b/Handler/Upload.hs @@ -34,7 +34,7 @@ postUploadR = do ((result, uploadWidget), enctype) <- runFormPost (uploadForm username) case result of FormSuccess temp -> do - path <- writeOnDrive $ tempMediumFile temp + path <- writeOnDrive username $ tempMediumFile temp medium <- return $ Medium (tempMediumTitle temp) path @@ -52,8 +52,8 @@ postUploadR = do setMessage $ [shamlet|
You need to be logged in|] redirect $ LoginR -writeOnDrive :: FileInfo -> Handler FilePath -writeOnDrive file = do +writeOnDrive :: Text -> FileInfo -> Handler FilePath +writeOnDrive username file = do filename <- return $ fileName file path <- return $ "static" > (unpack filename) liftIO $ fileMove file path diff --git a/templates/home.hamlet b/templates/home.hamlet index c131014..1a326df 100644 --- a/templates/home.hamlet +++ b/templates/home.hamlet @@ -1,6 +1,8 @@ $if null recentMediaThis gallery is still empty. $else - $forall (Entity mediaId medium) <- recentMedia + $forall (Entity mediumId medium) <- recentMedia