working on upload
This commit is contained in:
parent
56c1731d64
commit
3dc4bf631a
2 changed files with 7 additions and 5 deletions
|
@ -34,7 +34,7 @@ postUploadR = do
|
||||||
((result, uploadWidget), enctype) <- runFormPost (uploadForm username)
|
((result, uploadWidget), enctype) <- runFormPost (uploadForm username)
|
||||||
case result of
|
case result of
|
||||||
FormSuccess temp -> do
|
FormSuccess temp -> do
|
||||||
path <- writeOnDrive $ tempMediumFile temp
|
path <- writeOnDrive username $ tempMediumFile temp
|
||||||
medium <- return $ Medium
|
medium <- return $ Medium
|
||||||
(tempMediumTitle temp)
|
(tempMediumTitle temp)
|
||||||
path
|
path
|
||||||
|
@ -52,8 +52,8 @@ postUploadR = do
|
||||||
setMessage $ [shamlet|<pre>You need to be logged in|]
|
setMessage $ [shamlet|<pre>You need to be logged in|]
|
||||||
redirect $ LoginR
|
redirect $ LoginR
|
||||||
|
|
||||||
writeOnDrive :: FileInfo -> Handler FilePath
|
writeOnDrive :: Text -> FileInfo -> Handler FilePath
|
||||||
writeOnDrive file = do
|
writeOnDrive username file = do
|
||||||
filename <- return $ fileName file
|
filename <- return $ fileName file
|
||||||
path <- return $ "static" </> (unpack filename)
|
path <- return $ "static" </> (unpack filename)
|
||||||
liftIO $ fileMove file path
|
liftIO $ fileMove file path
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
$if null recentMedia
|
$if null recentMedia
|
||||||
<p>This gallery is still empty.
|
<p>This gallery is still empty.
|
||||||
$else
|
$else
|
||||||
$forall (Entity mediaId medium) <- recentMedia
|
$forall (Entity mediumId medium) <- recentMedia
|
||||||
<div class="thumbnails">
|
<div class="thumbnails">
|
||||||
<div class="single">
|
<a href=#{mediumPath medium}>
|
||||||
|
<img src=#{mediumPath medium}><br>
|
||||||
|
#{mediumTitle medium}
|
||||||
|
|
Loading…
Reference in a new issue