react-component / react-component/upload
建议formData.append(option.filename, option.file)时,将第三个参数也加上。
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 804
- Forks
- 323
- Avg merge
- 12m
- Merged PRs (30d)
- 1
Description
在使用IE11等不支持File constructor的浏览器的情况时,使用transformFile进行图片压缩时,只能返回blob类型数据。

由于request.js中代码 formData.append(option.filename, option.file)并未设置第三个参数filename的值,导致blob文件命名都会变成blob。
可以将代码修改为 formData.append(option.filename, option.file, option.file?.name)
这样只需要在返回blob时自定义blob 的name属性即可达到File类型的效果,而不需要复制一份request来修改代码,并传入customRequest属性来自定义上传表现。
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read request.js and locate the FormData append call used for transformed uploads. Reproduce the IE11/blob case described in the issue, then verify that uploaded blobs retain their intended filename without requiring a custom request implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100