(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...) |
m (moved CKFinder/Server Side Integration/The Commands/DownloadFile to CKFinder 1.x/Server Side Integration/The Commands/DownloadFile) |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
+ | {{CKFinder_SSI_Warning}} | ||
== DownloadFile == | == DownloadFile == | ||
Latest revision as of 07:46, 28 May 2010
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' ) ;