我正在尝试上传quickblox中的图片,我已经做了一次,但我现在收到了这条错误信息。
我的文件就是这样的一个:“/ data / user/0 /dinidiniz.tradersmtg / app_Traders MTG Images / Sat Apr 30 20:58:36 GMT-03:00 2016.png”。我测试过,它存在并且可以正常工作以获得位图。
我上传时使用:
QBContent.uploadFileTask(imageFile, fileIsPublic, null, new QBEntityCallback<QBFile>()
我收到此错误:
04-30 20:58:36.979 5634-5634/dinidiniz.tradersmtg W/System.err: com.quickblox.core.exception.QBResponseException: File upload onError,Incorrect content type
04-30 20:58:36.979 5634-5634/dinidiniz.tradersmtg W/System.err: at com.quickblox.content.task.TaskEntityUploadFile.performTask(TaskEntityUploadFile.java:74)
04-30 20:58:36.979 5634-5634/dinidiniz.tradersmtg W/System.err: at com.quickblox.content.QBContent.uploadFileTask(QBContent.java:560)
04-30 20:58:36.979 5634-5634/dinidiniz.tradersmtg W/System.err: at dinidiniz.tradersmtg.activities.ProfileEditActivity.changeAvatar(ProfileEditActivity.java:183)
04-30 20:58:36.979 5634-5634/dinidiniz.tradersmtg W/System.err: at dinidiniz.tradersmtg.activities.ProfileEditActivity.onActivityResult(ProfileEditActivity.java:166)
04-30 20:58:36.980 5634-5634/dinidiniz.tradersmtg W/System.err: at android.app.Activity.dispatchActivityResult(Activity.java:6442)
04-30 20:58:36.980 5634-5634/dinidiniz.tradersmtg W/System.err: at android.app.ActivityThread.deliverResults(ActivityThread.java:3716)
04-30 20:58:36.980 5634-5634/dinidiniz.tradersmtg W/System.err: at android.app.ActivityThread.handleSendResult(ActivityThread.java:3763)
04-30 20:58:36.980 5634-5634/dinidiniz.tradersmtg W/System.err: at android.app.ActivityThread.-wrap16(ActivityThread.java)
04-30 20:58:36.980 5634-5634/dinidiniz.tradersmtg W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1403)
04-30 20:58:36.980 5634-5634/dinidiniz.tradersmtg W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
04-30 20:58:36.980 5634-5634/dinidiniz.tradersmtg W/System.err: at android.os.Looper.loop(Looper.java:148)
04-30 20:58:36.980 5634-5634/dinidiniz.tradersmtg W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5443)
04-30 20:58:36.980 5634-5634/dinidiniz.tradersmtg W/System.err: at java.lang.reflect.Method.invoke(Native Method)
04-30 20:58:36.980 5634-5634/dinidiniz.tradersmtg W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
04-30 20:58:36.980 5634-5634/dinidiniz.tradersmtg W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
答案 0 :(得分:0)
需要添加“OutPutStream.flush();”在文件中创建图像后,它开始有内容。我忘记了这句话。