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...
Note
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.
Example:
curl -L --data-binary @sales.tgz http://cas.caringo.com/ \ -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, http://cas.caringo.com/UUID
, you will see it recognizes the supplied filename.
Note
© DataCore Software Corporation. · https://www.datacore.com · All rights reserved.