RocketChat / Rocket.Chat

The communications platform that puts data protection first.
https://rocket.chat/
Other
39.94k stars 10.29k forks source link

upload image such as sendFileMessage func, image file cannot open #13065

Open ZackLeonardo opened 5 years ago

ZackLeonardo commented 5 years ago
const result = await _ufsCreate.call(this, fileInfo);
let formData = new FormData();
let file = {
  uri: fileInfo.path,
  type: "image/JPEG",
  name: fileInfo.name
}; //

formData.append("file", file);

let options = {};
options.method = "POST";
options.headers = { "Content-Type": "multipart/form-data" };
options.body = formData;

await fetch(result.url, options);
image

but the image cannot be opened.

reetp commented 5 years ago

Can you please help the developers by filling out a proper bug report? They can't really help without this information Use this link: https://github.com/RocketChat/Rocket.Chat/issues/new?template=bug_report.md

Here is an example of how to do.it properly.  https://github.com/RocketChat/Rocket.Chat/issues/13069