postgrest-docs
postgrest-docs copied to clipboard
Add how-to upload images/files (bytea)
There's an issue right now with binaries sent using multipart/form-data
https://github.com/PostgREST/postgrest/issues/922#issuecomment-454085191, but there is an alternative using Javascript, for example with fetch:
const input = document.getElementById('myFileInput'');
fetch('http://localhost:3000/rpc/upload_binary', {
method: 'POST',
headers: {
"Content-Type": "application/octet-stream"
},
body: input.files[0]
})
An example using fetch
could be added while working on the multipart/form-data
implementation.