Table of contents
This page was set to be reviewed before 2018-06-04 by the page owner: #govuk-2ndline. This might mean the content is out of date. Read how to review a page.

Upload an asset to whitehall

Whitehall assets are changing - they will soon be migrated to Asset Manager. It’s worth checking with #govuk-platform-health on the status of the work before trying this.

Sometimes publishers ask us to help them upload very large attachments to documents in whitehall because they see timeouts when they try to upload the document themselves.

The simplest way to do this is to upload a small file and replace it on the server manually, making sure that it passes the usual virus scanning.

For apps other than whitehall, follow the asset manager upload guide instead.

  1. In whitehall, attach a small file to the document being edited. Ensure the file name matches the name of the real file.

  2. ssh to whitehall-backend-0.backend.production and cd /data/uploads/whitehall/incoming/system/uploads/attachment_data/file/. This is the directory which attachments are placed in before they are scanned for viruses and moved to the main assets directory.

  3. Check that there is a folder in this directory which matches the ID of the small uploaded file. You can find this in the URL of the attachment in whitehall e.g. the “123456” in https://whitehall-admin.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/123456/filename.zip

  4. Copy the real file from your computer to the server:

    scp filename.zip whitehall-backend-0.backend.production:/data/uploads/whitehall/incoming/system/uploads/attachment_data/file/123456/filename.zip
    
  5. Wait for it to be processed. After a minute or so it should disappear from the directory you uploaded it to. You should now be able to download the full size file from whitehall publisher.

  6. Run govuk_app_console whitehall on whitehall-backend-1 and fix the file metadata:

    a = AttachmentData.find(123456) # This should match the attachment ID used earlier
    a.file_size = 987654321 # The size in bytes of the full file
    a.save!
    
This page was set to be reviewed before 2018-06-04 by the page owner: #govuk-2ndline. This might mean the content is out of date. Read how to review a page.