- I am trying to upload an image in base64 format and then assign the upload file to the user object using the below code.
var byteArray = new Blob(["data:image/jpg;base64," + $scope.imageData]);
var savedFile = Backendless.Files.saveFile("media", "blouse.png", byteArray, true, new Backendless.Async(uploadOK, uploadError));
console.log("file : " + savedFile);
var blouseObject = new Blouse();
blouseObject.notes = comments;
blouseObject.user = Backendless.UserService.getCurrentUser();
blouseObject.approved = 0,
blouseObject.picture = savedFile;
var savedObj = Backendless.Persistence.of(Blouse).save(blouseObject);
Are there better way to do this? Are there any size restriction for image file size? I get the below error message making me assume that max file is 2.8 MB.
File Content size must be less than 2,800,000 bytes
- Even for a small size file, the uploaded file does not seem to be a valid image file. Am I using the base64 upload process correctly?
- I get the below error on creating the object attached with the image file. (image filename is “undefined” even thought it got uploaded successfully).
Cannot save entity with primitive collection property _private_dates
- How to automatically assign new file name as in Parse?
Please share some link or code snipped to be used with JavaScript.