画像のアップロードで Parse Server に移行した後、「無効なファイルのアップロード」というエラーが発生しました。
android-parse 1.13.1 と parse-server 2.3.2 を使用します。
新しい ParseFile に Content-Type "image/png" を追加しても問題は解決しません。
コード:
private ParseFile getParseFile(Bitmap file, String filename) {
// Convert it to byte
ByteArrayOutputStream stream = new ByteArrayOutputStream();
// Compress image to lower quality scale 1 - 100
file.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] image = stream.toByteArray();
return new ParseFile(filename, image, "image/png");
}
ParseFile squarePhotoFile = getParseFile(squarePhoto, "square_photo.png");
squarePhoto.recycle();
squarePhotoFile.saveInBackground(new SaveInBackgroundSquarePhotoCallback(squarePhotoFile));
助けてください!