mevdschee / mevdschee/php-crud-api
Returning user uploaded file using custom controller
Open
@mevdschee is already working on this.
Since Apr 2, 2024.
help wanted
- Dominant language
- PHP
- Stars
- 3.7k
- Forks
- 1k
- Avg merge
- 1h 55m
- Merged PRs (30d)
- 7
Description
Hi everybody.
I made a custom controller to handle file uploads and I'd like to add the capability to return the file via API made using this repository.
In the function __construct function I added:
$router->register('GET', '/records/file/*', array($this, 'getFileV2'));
In
public function getFileV2(ServerRequestInterface $request): ResponseInterface
I need to get the file, decrypt (because in POST controller function the file is correctly uploaded as encrypted) but also if I add
header("Content-Type: image/png");
return $decryptedFile;
I can't view the file and the error message is:
UploadUserFile::getFileV2(): Return value must be of type Psr\\Http\\Message\\ResponseInterface, string returned
How can I do this?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.