setupFiles = () => {
const filePath = serverURL + “files/profileData/”;
const suffix = “.txt”;
const self = this;
let data = {
name: “stuff”
};let profileData = new FormData(); profileData.append("file", data); profileData.append("name", { name: "profileData" }); Backendless.Files.upload( profileData, "profileData/" + self.props.getUser().ObjectId ) .then(function(fileURL) { console.log("RESPONSE", fileURL); }) .catch(function(error) { console.log("error", error); });
}
This runs after the user logs in, so the Backendles app is Initialized correctly. I just want to create and upload a file to the server using React and I keep getting
[Error: Wrong type of the file source object. Can not get file name].
I think this might be a React issue since it is a FrontEnd dev platform, but maybe I am not formatting the FormData correctily, and I can’t find another solution that doesn’t require the user to upload their own files to modify.
Any help would be appreciated.