Skip to content

File Storage

This is a Pro feature

Files can be uploaded to the local file system or to cloud storage. File uploads are enabled by default in Scoold Pro. To disable file uploads altogether set scoold.uploads_enabled = false. To protect uploaded files from unauthenticated access, set scoold.uploads_require_auth = true.

To upload a file just drag & drop the file onto the post editor area. A link will automatically appear when the upload is finished. Uploads can fail either because their size is too large or because their format is not in the white list of permitted formats (documents, images, archives, audio or video). You can extend the list of permitted file types by configuring:

scoold-application.conf
scoold.allowed_upload_formats = "yml,py:text/plain,json:application/json"

If the MIME type is not specified in the format extension:mime_type, the default text/plain is used when serving these files.

List of allowed file formats for uploads
File extensionMIME type
jpgimage/jpeg
jpegimage/jpeg
jpeimage/jpeg
gifimage/gif
pngimage/png
bmpimage/bmp
tiffimage/tiff
tifimage/tiff
icoimage/x-icon
svgimage/svg+xml
webpimage/webp
asfvideo/x-ms-asf
asxvideo/x-ms-asf
wmvvideo/x-ms-wmv
wmxvideo/x-ms-wmx
wmvideo/x-ms-wm
avivideo/avi
divxvideo/divx
flvvideo/x-flv
movvideo/quicktime
qtvideo/quicktime
mpegvideo/mpeg
mpgvideo/mpeg
mpevideo/mpeg
mp4video/mp4
m4vvideo/mp4
ogvvideo/ogg
webmvideo/webm
mkvvideo/x-matroska
3gpvideo/3gpp
3gppvideo/3gpp
3g2video/3gpp2
3gp2video/3gpp2
mp3audio/mpeg
m4aaudio/mpeg
m4baudio/mpeg
aacaudio/aac
raaudio/x-realaudio
ramaudio/x-realaudio
wavaudio/wav
oggaudio/ogg
ogaaudio/ogg
flacaudio/flac
midaudio/midi
midiaudio/midi
wmaaudio/x-ms-wma
waxaudio/x-ms-wax
mkaaudio/x-matroska
txttext/plain
xmltext/xml
ymlapplication/x-yaml
yamlapplication/x-yaml
jsonapplication/json
javatext/x-java
pytext/x-python
cstext/x-csharp
asctext/plain
ctext/x-csrc
htext/x-chdr
cctext/x-c++src
hhtext/x-c++hdr
srttext/plain
csvtext/csv
tsvtext/tab-separated-values
icstext/calendar
rtxtext/richtext
csstext/css
vtttext/vtt
dfxpapplication/ttaf+xml
rtfapplication/rtf
pdfapplication/pdf
tarapplication/x-tar
zipapplication/zip
gzapplication/x-gzip
gzipapplication/x-gzip
rarapplication/rar
7zapplication/x-7z-compressed
psdapplication/octet-stream
xcfapplication/octet-stream
docapplication/msword
potapplication/vnd.ms-powerpoint
ppsapplication/vnd.ms-powerpoint
pptapplication/vnd.ms-powerpoint
wriapplication/vnd.ms-write
xlaapplication/vnd.ms-excel
xlsapplication/vnd.ms-excel
xltapplication/vnd.ms-excel
xlwapplication/vnd.ms-excel
mdbapplication/vnd.ms-access
mppapplication/vnd.ms-project
docxapplication/vnd.openxmlformats-officedocument.wordprocessingml.document
docmapplication/vnd.ms-word.document.macroEnabled.12
dotxapplication/vnd.openxmlformats-officedocument.wordprocessingml.template
dotmapplication/vnd.ms-word.template.macroEnabled.12
xlsxapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheet
xlsmapplication/vnd.ms-excel.sheet.macroEnabled.12
xlsbapplication/vnd.ms-excel.sheet.binary.macroEnabled.12
xltxapplication/vnd.openxmlformats-officedocument.spreadsheetml.template
xltmapplication/vnd.ms-excel.template.macroEnabled.12
xlamapplication/vnd.ms-excel.addin.macroEnabled.12
pptxapplication/vnd.openxmlformats-officedocument.presentationml.presentation
pptmapplication/vnd.ms-powerpoint.presentation.macroEnabled.12
ppsxapplication/vnd.openxmlformats-officedocument.presentationml.slideshow
ppsmapplication/vnd.ms-powerpoint.slideshow.macroEnabled.12
potxapplication/vnd.openxmlformats-officedocument.presentationml.template
potmapplication/vnd.ms-powerpoint.template.macroEnabled.12
ppamapplication/vnd.ms-powerpoint.addin.macroEnabled.12
sldxapplication/vnd.openxmlformats-officedocument.presentationml.slide
sldmapplication/vnd.ms-powerpoint.slide.macroEnabled.12
onetocapplication/onenote
onetoc2application/onenote
onetmpapplication/onenote
onepkgapplication/onenote
oxpsapplication/oxps
xpsapplication/vnd.ms-xpsdocument
odtapplication/vnd.oasis.opendocument.text
odpapplication/vnd.oasis.opendocument.presentation
odsapplication/vnd.oasis.opendocument.spreadsheet
odgapplication/vnd.oasis.opendocument.graphics
odcapplication/vnd.oasis.opendocument.chart
odbapplication/vnd.oasis.opendocument.database
odfapplication/vnd.oasis.opendocument.formula
wpapplication/wordperfect
wpdapplication/wordperfect
keyapplication/vnd.apple.keynote
numbersapplication/vnd.apple.numbers
pagesapplication/vnd.apple.pages

By default, the size of uploaded files is unrestricted. To limit the maximum size of uploads, set the following Spring Boot system properties:

scoold-application.conf
spring.servlet.multipart.max-file-size = "2MB"
spring.servlet.multipart.max-request-size = "10MB"

Scoold Pro also allows users to capture and upload video and audio from their input devices (mic/webcam). This functionality is enabled by default:

scoold-application.conf
scoold.media_recording_allowed = true

Profile pictures (avatars) can also be changed by dragging a new image on top of the existing profile picture on a user’s /profile page. For best results, use a square image here.

Local file storage is used by default. To configure the directory on the server where files will be stored, set:

scoold-application.conf
scoold.file_uploads_dir = "uploads"

To use S3 for file storage, specify the name of the S3 bucket where you want the files to be uploaded. AWS credentials and region settings are optional as they can be picked up from the environment automatically.

scoold-application.conf
# required
scoold.s3_bucket = ""
# path within the bucket (object prefix)
scoold.s3_path = "uploads"
# these are optional
scoold.s3_region = ""
scoold.s3_access_key = ""
scoold.s3_secret_key = ""

To use Azure Blob storage for storing uploaded files, first you’ll need to create a storage account and get a SAS URL and token. Scoold Pro will need full permissions to your storage container so it’s best that you dedicate a container just for Scoold files.

scoold-application.conf
# required
scoold.blob_storage_account = ""
scoold.blob_storage_token = ""
# name of the container
scoold.blob_storage_container = ""
# path prefix within a container (subfolder)
scoold.blob_storage_path = "uploads"

This feature is available in both Scoold and Scoold Pro. You can configure Scoold to upload custom profile pictures to a cloud-based image hosting service like Imgur or Cloudinary. In Scoold Pro, avatars are uploaded to the configured storage provider, but by configuring Imgur or Cloudinary for avatars, you will essentially change where avatars are stored and served from.

To use Imgur for storing images, specify your Imgur API client id:

scoold-application.conf
scoold.imgur_client_id = "x23e8t0askdj"
scoold.avatar_repository = "imgur"

Keep in mind that only images can be uploaded to Imgur and other restrictions may apply.

To use Cloudinary for storing images, specify your Cloudinary API client id:

scoold-application.conf
scoold.cloudinary_url = "cloudinary://123456:abcdefaddd@scoold"
scoold.avatar_repository = "cloudinary"

Keep in mind that only images can be uploaded to Cloudinary and other restrictions may apply.

You must create several presets on your cloudinary account:

  • avatar (upload preset): for processing when receiving a file (example: c_thumb,g_face,h_404,q_auto:good,w_404,z_0.4)
  • square25: for the display in 25x25 format (example: c_scale,h_25,q_auto:eco,w_25)
  • square32: for displaying in 32x32 format (example: c_scale,h_32,q_auto:eco,w_32)
  • square50: for displaying in 50x50 format (example: c_scale,h_50,q_auto:good,w_50)
  • square127: for displaying in 127x127 format (example: c_scale,h_127,q_auto:good,w_127)
  • profile: for displaying in 404x404 format (example: c_scale,h_404,q_auto:good,w_404)

By default, Scoold will only serve static files from the /static folder on the classpath (inside the JAR). If you want to configure it to serve additional resources from a local directory, set this system property:

scoold-application.conf
spring.web.resources.static-locations = "classpath:/static/, file:/home/scoold/static-folder/"

Then, for example, a file located at /home/scoold/static-folder/file.png will be served from localhost:8000/file.png. For more information, check the Spring Boot documentation.

Scoold will serve static files (JS, CSS, fonts) from the same domain where it is deployed. You can configure the scoold.cdn_url to enable serving those files from a CDN. The value of the CDN URL must not end in ”/”.