comments #8 - DRYed up the code for file saving a bit

Signed-off-by: Alexander Skjolden <alex@plastboks.net>
comments #8 - now with mimes for files

Signed-off-by: Alexander Skjolden <alex@plastboks.net>
comments #8 - use the filemime in file download

Signed-off-by: Alexander Skjolden <alex@plastboks.net>
Merge branch 'file' into develop