How to get the browser to download a file from Swarm using its filename instead of UUID?

Created 10/22/2014 avi · Updated 2/20/2017 aaron.enfield

Modern browsers require the following headers, which control different functions:

1 - Content-type

This tells the browser what mime-type your file is, and will control how the browser will interpret the download,

Which associated application to open etc... so office for word files, acrobat for pdf etc...


If you want the browser to always just download the file don't specify the content-type, or make sure it's a type that is not associated with an application.

2 - Content-disposition

This tells the browser what the desired filename is when you download, if you wish your file to be downloaded by its original filename instead of a UUID, you need to use this header as described in the HTTP spec.


curl -L --data-binary @sales.tgz \
	-H "Content-type:application/x-gzip" \
	-H "Content-disposition: filename=sales.tgz" -v

Grab the resulting UUID and try and download it from a browser,, you will see it recognizes the supplied filename.


Using named objects does not require the content-disposition header, as by default the browser will use the last part of the URI as the filename.

© DataCore Software Corporation. · · All rights reserved.