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

[Question]chooseImage在web端拿到的接口在upload不能直接用感觉有点麻烦 #210

Open
yiescc opened this issue Aug 12, 2021 · 1 comment

Comments

@yiescc
Copy link

yiescc commented Aug 12, 2021

chooseImage({
  count: 1,
  sourceType: ['album', 'camera']
}).then(res => {
  const tempFilePaths = res.tempFilePaths
});

在web端 path 是 blob URL blob://xxxx

const task = upload({
  url: 'http://httpbin.org/post',
  fileType: 'image',
  fileName: 'file',
  filePath: '**filePath**',
  success: res => {
    console.log('upload success');
  },
  fail: res => {
    console.log('upload fail');
  },
});

然后upload这里并不能传blob URL

导致得手动转成file

const imgBlob = await fetch(tempFilePath).then((r) => r.blob());
const file = new File([imgBlob], fileName);

感觉很麻烦

然后

  • web虽然res对象里file数组,但是还是希望和其他端统一拿到的是path

需求

  • web端 chooseImage那到的内容upload能直接使用
@DOBEEE
Copy link
Collaborator

DOBEEE commented Aug 25, 2021

确认问题,内部评估中

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

2 participants