upload file blob
See original GitHub issueHello, I would like to store documents in a blob field. For that I have the following entity:
/**
* @ApiResource(
* collectionOperations={
* "get"={"method"="GET", "normalization_context"={"groups"={ "get_document"}}},
* "post"={"method"="POST", "denormalization_context"={"groups"={"post_document"}}},
* },
* itemOperations={
* "get"={"method"="GET", "normalization_context"={"groups"={"get_document"}}},
* "put"={"method"="PUT", "denormalization_context"={"groups"={"put_document"}}},
* "delete"={"method"="DELETE"},
* },
* attributes={"order"={"dateDocument": "ASC"}}
* )
* @ApiFilter(SearchFilter::class, properties={"logement.id": "exact"})
* @ORM\Entity(repositoryClass="App\Repository\DocumentRepository")
*/
class Document
{
/**
* @ORM\Id()
* @Groups({"get_document"})
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer", name="id_document")
*/
private $id;
/**
* @Groups({"get_document"})
* @ORM\Column(type="blob")
*/
private $contenuDocument;
...
When I do a get_document, I get the following message:
title : An error occurred
detail: An unexpected value could not be normalized: NULL
Do you have an idea please?
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Upload a blob using .NET - Azure Storage - Microsoft Learn
Upload to a stream in Blob Storage ... You can open a stream in Blob Storage and write to that stream. The following...
Read more >How can javascript upload a blob? - jquery - Stack Overflow
append call, trying to get the blob data as a string by getting the values at URL.
Read more >How to Upload a File to Azure Blob Storage
Now that we uploaded the data to the Azure storage account let's open the Azure portal to verify the upload. Open the container's...
Read more >How to Upload a File to Azure Blob Storage | .NET 6 - YouTube
Azure Blob Storage offers a simple way to store files such as images or JSON data in the cloud. This tutorial will teach...
Read more >How can JavaScript upload a blob ? - GeeksforGeeks
There are many ways to upload a blob (a group of bytes that holds the data stored in a file) in JavaScript, using...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Anyway, I’m not sure embedding binary data in JSON makes sense…
Thanks for your quikly answer.
I think i will create a custom controller to return the filestream directly. I think it’s a best practice that retourn this stream in base64 (front js is not the best for decoding)
Thanks.