This is the official manual for the latest Org-mode release.
The header argument
:file is used to specify an external file in which
to save code block results. After code block evaluation an Org mode style
[[file:]] link (see Link format) to the file will be inserted
into the Org mode buffer. Some languages including R, gnuplot, dot, and
ditaa provide special handling of the
:file header argument
automatically wrapping the code block body in the boilerplate code required
to save output to the specified file. This is often useful for saving
graphical output of a code block to the specified file.
The argument to
:file should be either a string specifying the path to
a file, or a list of two strings in which case the first element of the list
should be the path to a file and the second a description for the link.