File uploads on your self-hosted server


In order to upload files you have to have an active subscription for your user. Read the subscriptions page on instructions how to setup a subscription for yourself.


Files Server URL

In your .env file the environment variable PUBLIC_FILES_SERVER_URL has to be set to a publicly accessible url. The reason for that is that the clients are accessing the Files Server directly instead of via Api Gateway. Remember that if you are hosting your self-hosted instance on an external server then localhost is not the host that properly describes where the files server resides.

Upload directory write permissions

The default upload directory is located inside your working directory under uploads/. Depending on the running OS, you might encounter write permissions to that folder by the application. In that case the following commands might help:

chmod -R 775 data
mkdir -p uploads
sudo chmod -R 755 uploads
sudo chown -R 1001.1001 uploads

Limiting Storage Quota

If you would like to limit the file upload quota for your user then make sure to run the following query on your database:

INSERT INTO subscription_settings(uuid, name, value, created_at, updated_at, user_subscription_uuid) VALUES (UUID(), "FILE_UPLOAD_BYTES_LIMIT", 10737418240, FLOOR(UNIX_TIMESTAMP(NOW(6))*1000000), FLOOR(UNIX_TIMESTAMP(NOW(6))*1000000), (SELECT us.uuid FROM user_subscriptions us INNER JOIN users u ON us.user_uuid=u.uuid WHERE"EMAIL@ADDR"));

Note that this is setting the limit to 10GB (10737418240 bytes) for user with email EMAIL@ADDR

CloudFlare Missing Headers

When using CloudFlare in conjuction with Nginx you might encounter an issue about missing Accept-Ranges header which is required for file downloading. As a fix please add this to your Nginx configuration:

proxy_cache off;

Other ways to get help

Browse or post to the forum
Recommended for non-account related issues.
Join the Standard Notes Discord group
Recommended for small talk.
Send an email to [email protected]
Recommended for account related issues.