Upload Your Files

Learn how to upload your files.

Discuss in our Forum Discuss in Slack

Files refer to everything stored inside sites/default/files. This usually consists of uploaded images, generated stylesheets, aggregated scripts, etc. Files are not under Git version control and are stored separately from the site's code.

You can use the Pantheon Dashboard, SFTP, or Rsync to upload your site's files.

Follow the steps below to export a tar.gz or .zip file of your directory files.

1. Export a `tar.gz` or `.zip` file of your files directory:

Navigate to your Drupal site's root directory to run this command, which will create an archive file in your user's home directory:

cd sites/default/files
tar -czf ~/files.tar.gz .
  1. Select the Dev environment in the Site Dashboard.

  2. Select Database / Files.

  3. Click Import and add your archive accordingly (based on file size):

    If your archive is under 100MB, you can upload the file directly:

    1. Click File in the MySQL database field > Choose File.

    2. Select your local archive file and click Import.

      Import MySQL database from file

    Note: If you recently imported the database and need to re-import, refresh the page and use a new filename for the database file.

    If your archive is less than 500MB, you can import it from URL:

    1. Click URL in the Archive of site files field.

    2. Paste a publicly accessible URL for the archive and click Import.

      • Change the end of the Dropbox URLs from dl=0 to dl=1 to ensure that your archive imports correctly.

    Rsync is an excellent method for transferring a large number of files. After performing an initial rsync, subsequent jobs will only transfer the latest changes. This can help minimize the amount of time a site is in an unpredictable state (or offline) during the final step of a migration, as it allows you to bring over only new content, rather than re-copying every single file.

    We recommend looking into the Terminus Rsync Plugin as a helper when doing these operations, as the number of command line arguments and specifics of directory structure make it easy for human error to impact your operation.

    To sync your current directory to Pantheon, run the following command:

    terminus rsync . my_site.dev:files

    When using Rsync manually, the script below is useful for dealing with transfers that are interrupted due to connectivity issues. It uploads files to your Pantheon site's Dev environment. If an error occurs during transfer, it waits two minutes and picks up where it left off:

    # manual-rsync-script.sh
    # runs Rsync and waits two minutes if it doesn't work
    read -sp "Your Pantheon Password: " PASSWORD
    if [[ -z "$PASSWORD" ]]; then
    echo "Whoops, need password"
    while [ 1 ]
        sshpass -p "$PASSWORD" rsync --partial -rlvz --size-only --ipv4 --progress -e 'ssh -p 2222' ./files/* --temp-dir=../tmp/ $ENV$SITE@appserver.$ENV.$SITE.drush.in:files/
    if [ "$?" = "0" ] ; then
        echo "rsync completed normally"
        echo "Rsync failure. Backing off and retrying..."
        sleep 180