Closed tertek closed 6 months ago
Slim Framework provides an interface with some methods to handle files that could be useful:
The file uploads in $_FILES are available from the Request object’s getUploadedFiles() method. This returns an array keyed by the name of the input element.
Each object in the $files array is an instance of
Psr\Http\Message\UploadedFileInterface
For more information: https://www.slimframework.com/docs/v4/objects/request.html#uploaded-files
Additional information on file uploading and handling:
Slim eBook Vol. 2: Chapter "File Uploads", p. 38 - 49 (file upload basics)
Slim eBook Vol. 2: Chapter "Flysystem v3", p.49 - 83 (file storage library)
Slim eBook Vol. 2: Chapter "ZIP files", p.208 - 217 (ZIP File Creation and Download)
Slim eBook Vol. 3 Chapter "Amazon S3", p. 9 - 21 (Simple Storage Service) ; this is only relevant for later, but for now it is good to know how to build the abstraction layer
secure mime type detection tool for uploads: composer require league/mime-type-detection, see https://ebook.odan-consulting.com/slim4-vol2/articles/file-uploads#usage
secure mime type detection tool for uploads: composer require league/mime-type-detection, see https://ebook.odan-consulting.com/slim4-vol2/articles/file-uploads#usage
@edenst-TPH We can build the filesystem service around the Flysystem Adapter: SlimBook vol 2, chapter Flysystem 3 and also
https://flysystem.thephpleague.com/docs/adapter/local/
For now we would only need local
@edenst-TPH I have added FileSystem library and configured. https://github.com/Research-IT-Swiss-TPH/pdf-form-filling-api/tree/FileSystem
It does not work 100% yet. As soon as I have it fixed, it will be merged into DEV.
@edenst-TPH Please check the PR, which is ready to merge: https://github.com/Research-IT-Swiss-TPH/pdf-form-filling-api/pull/37
I will merge tomorrow so that we can continue with the next steps. But it is good for you to know what has been added in the PR.
Merged into dev.
For writing, deleting, updating and reading documents, a sustainable file handling approach is required. The requirements are: