Documentation

Temp Uploads Location

By default, Craft will store the temporary copies of uploaded files in a local temp directory on the filesystem of the server it's running on. 95% of the time, this is fine and works perfectly well.

However on Servd, several of our plans are load-balanced, or in other words, Craft is run across multiple servers. This means that if one Craft server is storing a temporary upload in a local temp directory, then the other Craft servers won't have access to it.

This can present problems if a plugin uploads a file to Craft with one request, and then sends a second request to trigger the file to be processed. The upload could be sent and stored on one server, whilst the second request could be sent to another. Such a scenario usually results in a file-not-found error because the server that handles the second request can't find the upload at the temporary location.

Retour and Campaign are two popular plugins that have been observed to behave in this way when CSVs are imported.

Solution #

The fix involves configuring Craft to use a central remote location for temporary uploads that all project servers can read from.

  1. Log into your local project's Control Panel.

  2. Navigate to the Asset settings page. Usually found at /admin/settings/assets/settings

  3. Open the "Temp Uploads Location" dropdown and select a remote volume. If you don't have any available, you may need to create a Servd Asset Volume and Filesystem

  4. Click the "Save" button.

  5. Commit and push the project config changes to your git repository.

  6. Create a new bundle from the commit.

  7. Sync the new bundle to one of your environments.