postgrest-docs icon indicating copy to clipboard operation
postgrest-docs copied to clipboard

Add how-to upload images/files (bytea)

Open laurenceisla opened this issue 2 years ago • 0 comments

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.

laurenceisla avatar May 24 '22 18:05 laurenceisla