Uploading a file with the purpose user_data is now more canonical, considering that the Assistants endpoint is deprecated.
You have built in as types of user role input for full understanding of “attachment”:
text: plain language
gpt-4 vision: the AI looking at images encoded for its multimodal understanding. These are placed as parts of a user message
PDF file: these use document extraction, either the text that can be programmatically obtained from pages, or the image of a page. Unreliable since introduction, with the quality not inspectable.
Otherwise, a “uploaded file” can only be employed by file search with a vector store: a multi-turn search for knowledge that the AI model must do itself via a tool call.
Building text yourself is the most reliable method, providing you have appropriate technology in place to utilize the file and make it presentable and understandable as language, and it does not have excessive length ultimately distracting the AI.