Summary
I am sending files to upload, I get return code 400, but I can’t understand why.
Steps to reproduce
Version 5.10.0.
Send request via cUrl
curl -X POST
‘http://192.168.240.59:8065/api/v4/files?channel_id=165uz8nugfd4uru4bcs615t9za&filename=http://192.168.240.59:8065/uploads/chat/k9ejeffafjfxzdeh1g7hb4wk7o_image.png’
-H ‘Authorization: Bearer 1tg1wkq3a3nsjy8cqxinggbanw’
-H ‘Content-Type: multipart/form-data’
-H ‘Postman-Token: 27fc8d02-a2d3-4f6b-8b4e-d18b014e982f’
-H ‘cache-control: no-cache’
Expected behavior
Sending the file path (which has already been saved in host directory) and the channel through cURL, should receive a positive API return, something like the pattern:
{
“file_infos”: [
{
“id”: “string”,
“user_id”: “string”,
“post_id”: “string”,
“create_at”: 0,
“update_at”: 0,
“delete_at”: 0,
“name”: “string”,
“extension”: “string”,
“size”: 0,
“mime_type”: “string”,
“width”: 0,
“height”: 0,
“has_preview_image”: true
}
],
“client_ids”: [
“string”
]
}
Observed behavior
Receiving return with error
{“id”:“api.file.upload_file.read_request.app_error”,“message”:“Não foi possível enviar o(s) arquivo(s). Erro ao ler ou decodificar a requisição.”,“detailed_error”:"",“request_id”:“7jawnwn71pnkdkhh1xyne6xmio”,“status_code”:400}
I’m using portuguese language, but the error message is something like “The file (s) could not be sent. Error reading or decoding request.”