Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

用户头像的上传 下载与本地保存 #12

Open
littleWatermelonSeed opened this issue Sep 12, 2017 · 0 comments
Open

用户头像的上传 下载与本地保存 #12

littleWatermelonSeed opened this issue Sep 12, 2017 · 0 comments

Comments

@littleWatermelonSeed
Copy link

我在我的用户类里面加了一个头像(BmobFile类型),在上传的时候代码如下:
headImg = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/headimg.png");
BmobFile bmobFile = new BmobFile(headImg);
mUserBean.setHeadPortrait(bmobFile);
报错:错误代码107,错误信息是filename为空

然后我改成三个参数的构造方法,代码如下:
headImg = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/headimg.png");
BmobFile bmobFile = new BmobFile("headimg2","", headImg.toString());
mUserBean.setHeadPortrait(bmobFile);
上传成功,控制台也出现了头像属性(不过点属性值进去是404)

但是不能下载,我通过url并不能获取图片,而且本地缓存的用户信息里面也没有头像:
userBean.getHeadPortrait().getFileUrl()通过这个方法获取url来下载文件为空
userBean.getHeadPortrait().getLocalFile()我通过这个方法得到的文件为空
上面userBean我是通过BmobUser.getCurrentUser()这个方法获取的

真心能求解答,我项目现在在这个点上遇到瓶颈啦

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant