Move section Downloads

Signed-off-by: Christian Wolf <github@christianwolf.email>
This commit is contained in:
Christian Wolf
2025-02-28 16:00:52 +01:00
parent c2040e8c5c
commit 0ac03ca900

View File

@@ -662,6 +662,27 @@ A redirect can be achieved by returning a RedirectResponse:
Downloads
^^^^^^^^^
A file download can be triggered by returning a DownloadResponse:
.. code-block:: php
<?php
namespace OCA\MyApp\Controller;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\DownloadResponse;
class PageController extends Controller {
public function downloadXMLFile(): DownloadResponse {
$path = '/some/path/to/file.xml';
$contentType = 'application/xml';
return new DownloadResponse($path, $contentType);
}
}
Creating custom responses
^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -795,30 +816,6 @@ The following policy for instance allows images, audio and videos from other dom
---
Downloads
^^^^^^^^^
A file download can be triggered by returning a DownloadResponse:
.. code-block:: php
<?php
namespace OCA\MyApp\Controller;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\DownloadResponse;
class PageController extends Controller {
public function downloadXMLFile(): DownloadResponse {
$path = '/some/path/to/file.xml';
$contentType = 'application/xml';
return new DownloadResponse($path, $contentType);
}
}
Creating custom responses
^^^^^^^^^^^^^^^^^^^^^^^^^