Opportunistic Upload
# Opportunistic Upload
# What is it?
Opportunistic upload allows your documents to be automatically synced with DocAPI while online and while you work on your documents. This is useful as it can also prevent data-loss by continuously keeping your local changes synchronized with DocAPI.
# Terminology
- Check Out/In - If a user needs offline or exclusive access to a class they can download the documents to their machine and ‘lock’ the class id and folder such that they may perform modifications to those documents without an internet connection as the documents are stored locally.
- Opportunistic Upload - The automated process which attempts to keep local-copies of documents synchronized with the DocAPI class from which they were checked out.
- Auto Save - The automated process which attempts to continuously store changes made to documents to the local drive.
- Dirty - A document that has been modified, but not yet synchronized with DocAPI.
- Clean - A document which has been synchronized with DocAPI.
- Override - Remotely removes a user’s check-out lock on a class folder.
# How do I enable it?
There are quite a few criteria that must be met before opportunistic uploads will occur. Firstly, auto-uploads must be enabled in the class settings within the designer.
Secondly, opportunistic uploads will not enable if Check In/Out is set to No as this means that users will only be able to download an immutable cache of the remote documents.
Opportunistic uploads will also not execute if New Name is set to Force, as this means that a new document would be created each time any individual markup is made.

By extension, it will also only run if either security_replace is set to Y and rename_markup is N, or for a document, if security_create is Y and rename_markup is Y or O.
# When does it execute?
Auto-saves occur one second after the last modification made to a document if it has been checked out, while opportunistic uploads will attempt to auto-sync your documents 10 seconds after the last modification. If another edit is made during this 10-second wait, the timer will reset back to 10 seconds. This is done to prevent constant re-uploads of documents while they are being worked on which would be a heavy load on the server.
When you login or re-gain a connection to the server, the client will also scan through all checked out documents and see if any are marked as dirty, upon finding any of these it will make sure to upload them immediately.
# Overrides
An override button should generally only be accessible by administrators, as this button will remove any check-out locks that a user may have, and will send a notification to that user’s device which will wipe and delete their lock - and all documents - for that specific class folder off of their device.