Documentation on file upload via the api


As shown I’m trying to learn how to send files directly via the api.

The problem is when I click on the <>Code button above, instead of giving me the file upload code, the entire screen freezes and nothing happens.

I reported the above bug to OpenAI but didn’t get a response.

Is there any documentation on sending files in messages via the api ?

I have a react Frontend with a component ImageUploader. it fetches a POST request from my own httpServer and that backend is capable of communicating with the OpenAI API.

effectively the code i have is a frontend fetch and a backend router call to return the result once received. i use it for image inspection ( return the prompt describing the image)
if you think that some code snippets would help then i can share them

by the way:
https://platform.openai.com/docs/guides/pdf-files?api-mode=chat

explains how to upload pdfs to the API

1 Like