upload now purges old filename
This commit is contained in:
parent
485fe73fde
commit
d6d79166f1
1 changed files with 5 additions and 2 deletions
|
@ -181,11 +181,14 @@ generateThumb path userId albumId = do
|
||||||
|
|
||||||
writeOnDrive :: FileInfo -> UserId -> AlbumId -> Handler FP.FilePath
|
writeOnDrive :: FileInfo -> UserId -> AlbumId -> Handler FP.FilePath
|
||||||
writeOnDrive fil userId albumId = do
|
writeOnDrive fil userId albumId = do
|
||||||
filen <- return $ fileName fil
|
--filen <- return $ fileName fil
|
||||||
|
album <- runDB $ getJust albumId
|
||||||
|
filen <- return $ show $ (length $ albumContent album) + 1
|
||||||
|
ext <- return $ FP.takeExtension $ T.unpack $ fileName fil
|
||||||
path <- return $ "static" FP.</> "data"
|
path <- return $ "static" FP.</> "data"
|
||||||
FP.</> (T.unpack $ extractKey userId)
|
FP.</> (T.unpack $ extractKey userId)
|
||||||
FP.</> (T.unpack $ extractKey albumId)
|
FP.</> (T.unpack $ extractKey albumId)
|
||||||
FP.</> (T.unpack filen)
|
FP.</> filen ++ ext
|
||||||
liftIO $ fileMove fil path
|
liftIO $ fileMove fil path
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue