From 3dc4bf631a2c6d094f5c46c4d79c9abf258b0e1f Mon Sep 17 00:00:00 2001 From: nek0 Date: Wed, 13 Aug 2014 19:34:42 +0200 Subject: [PATCH] working on upload --- Handler/Upload.hs | 6 +++--- templates/home.hamlet | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) 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 recentMedia
   

This gallery is still empty. $else - $forall (Entity mediaId medium) <- recentMedia + $forall (Entity mediumId medium) <- recentMedia