File links
The public link of a stored file, how to force a download and what the answer contains.
On this page
Every file has a public link in this form:
/files/{db}/{id}-{checksum}.{ext}For example /files/photos/JapO3b1e961f-pn.png. You get it in the url field of every upload answer. Use it as it is; do not build it yourself, because the checksum part is calculated by OpenFiles.
Open a file
The link needs no token and no sign-in. Anyone who has it can open the file, so put it in an <img> tag, a page or an email:
<img src="https://files.example.com/files/photos/JapO3b1e961f-pn.png" alt="Sunset">The answer has the file's content type. For images it also has the size in headers:
HTTP/1.1 200 OK
x-width: 640
x-height: 480
x-size: 2795
content-type: image/pngForce a download
Add ?download=1 to make the browser save the file under its name instead of showing it:
/files/photos/JapMXB1db60f-qt.png?download=1The answer then has:
content-disposition: attachment; filename*=utf-8''sunset.pngThe name is the current file name, so a file you renamed downloads with its new name.
When a link answers 404
- The file was removed, or its storage was dropped.
- The checksum part is wrong, for example because the link was typed by hand.
- The file was uploaded with an ID that contains a hyphen. Use IDs with letters and digits only.