(New page: == DownloadFile == Downloads a file from the server. === Sample Request === Download the file named “Test.jpg” from the the root directory of the resource type “Files”. <pre>con...) |
|||
Line 1: | Line 1: | ||
+ | {{CKFinder_SSI_Warning}} | ||
== DownloadFile == | == DownloadFile == | ||
Revision as of 15:36, 16 January 2008
DownloadFile
Downloads a file from the server.
Sample Request
Download the file named “Test.jpg” from the the root directory of the resource type “Files”.
connector.php?command=DownloadFile&type=Files¤tFolder=%2F&FileName=Test.jpg
Response
This command doesn’t expect the connector to return a text response. Instead, it must stream the file data to the browser.
An important difference between a “download” stream and a normal stream, is that the “Save as” dialog will always show in the browser, instead of opening the file on it (like for .html or .jpg file). To achieve that, the “Content-Disposition” header must be set accordingly. For example, the following is the code to set the header when the “Test.jpg” file is requested (in PHP):
header( 'Content-Type: application/octet-stream' ) ; header( 'Content-Disposition: attachment; filename=Test.jpg' ) ;