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

add blob type #52

Merged
merged 1 commit into from
Sep 23, 2016
Merged

add blob type #52

merged 1 commit into from
Sep 23, 2016

Conversation

purelanren
Copy link

对beforeUpload的返回值添加Blob类型的判断

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.05%) to 30.933% when pulling 4962405 on purelanren:master into 13a1dc1 on react-component:master.

@shepherdwind
Copy link
Contributor

很赞,有 mr 了

close #48

@@ -88,7 +88,8 @@ const AjaxUploader = React.createClass({
const before = props.beforeUpload(file);
if (before && before.then) {
before.then((processedFile) => {
if (Object.prototype.toString.call(processedFile) === '[object File]') {
const processedFileType = Object.prototype.toString.call(processedFile);
if (processedFileType === '[object File]' || processedFileType === '[object Blob]') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blob 模式确定可以上传文件不?有本地试过吧

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以的,有试过,thx

@shepherdwind shepherdwind merged commit 70b9749 into react-component:master Sep 23, 2016
@hejueting
Copy link

2016年的问题了,刚刚遇到了这个问题,再来反馈一下,倒不是Blob类型不能上传的坑,upload组件上传文件后,默认会有一个文件列表展示,如果是Blob类型上传的话,就会因为文件列表展示报错。

一开始我没有看到 showUploadList 这个属性去控制文件列表的显示,就手动 display:none 去隐藏的文件列表,所以一开始一直上传报错,报错原因也来自于组件的渲染,后来我用 showUploadList 这个属性去隐藏文件列表后,就能顺利上传图片了。我去查看了一下dom元素,文件列表相关的dom元素就不在了。

所以,一开始上传报错,我的第六感告诉我,文件列表那个dom元素的渲染有部分会基于file对象来进行的(这里是blob对象),但是blob对象里面缺少了很多属性就导致了渲染时报错。

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

Successfully merging this pull request may close these issues.

4 participants