I want to store uploaded files in Oracle database .
I'm using Doctrine in Symfony 5. I made an entity "Attachment", with a property "filename" (type string) and "filecontent" (type blob).
The following code is in controller, to get files uploaded, transform file content in stream, and store it in database
$attachments = $form->get('attachments')->getData();
if (count($attachments) > 0) {
foreach ($attachments as $attachment) {
$attach = new Attachment();
$attach->setFilename($attachment->getClientOriginalName());
$strm = fopen($attachment->getRealPath(), 'rb');
$attach->setFilecontent(stream_get_contents($strm));
$em->persist($attach);
}
}
When i submit the form, i have the error :
Warning: PDOStatement::execute(): supplied argument is not a valid stream resource
On a MySQL database, all is allright. File is correctly stored in database, no "stream ressource" issue. I've found an old workaround here : https://groups.google.com/g/doctrine-user/c/JILLBji__MU but maybe there is a final solution to this problem.
Could you help me ? Thanks
