【发布时间】:2017-01-23 11:55:34
【问题描述】:
通过图像上传迁移到 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));
请帮忙!
【问题讨论】:
标签: android mongodb parse-platform parse-server parse-android-sdk