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

Upload上传excel文件出错 #8116

Closed
ghost opened this issue Nov 6, 2017 · 18 comments
Closed

Upload上传excel文件出错 #8116

ghost opened this issue Nov 6, 2017 · 18 comments
Labels

Comments

@ghost
Copy link

ghost commented Nov 6, 2017

Version

2.11.1

Environment

ant 2.11.1,谷歌浏览器

Reproduction link

https://codepen.io/sunhoudong/pen/wPWoVM

Steps to reproduce

What is expected?

可以正常上传

What is actually happening?

监听上传的status,前两次都是uploading,第三次是error

@ant-design-bot
Copy link
Contributor

It will be better to write your issue/comment in English, so more people can understand you.
And this means that more people can help you or benefit from your issue/comment.
See: #4897

@yesmeck
Copy link
Member

yesmeck commented Nov 6, 2017

Your link is not working.

@ghost
Copy link
Author

ghost commented Nov 6, 2017

@yesmeck 这里面,uploadParams因为是临时的,所以我不好贴出来,主要问题出在onChange方法里面,我按照官网的例子,加了进去,第一次上传,一直是uploading,uploading,error,第二次就可以成功了

@yesmeck
Copy link
Member

yesmeck commented Nov 6, 2017

那最起码你要提供具体的错误信息。

@ghost
Copy link
Author

ghost commented Nov 6, 2017

status拿到的就是error,他POST到我当前页面里面了,然后就是request.js:96 POST http://localhost:8099/addInsurance 500 (),报500错误

@yesmeck
Copy link
Member

yesmeck commented Nov 6, 2017

那是你服务端的错误,检查下请求和服务端的日志吧。

@yesmeck yesmeck closed this as completed Nov 6, 2017
@ghost
Copy link
Author

ghost commented Nov 6, 2017

@yesmeck 我是上传到阿里云oss,如果是你说的那样,第二次也不会成功

@yesmeck
Copy link
Member

yesmeck commented Nov 6, 2017

oss 出错会返回错误信息的,自己查下吧。

@ant-design-bot
Copy link
Contributor

Hello @sunhoudong, we use GitHub issues to trace bugs or discuss plans of Ant Design. So, please don't ask usage questions here. You can try to ask questions on Stack Overflow or Segment Fault, then apply tag antd and react to your question.

@yesmeck yesmeck added the Usage label Nov 6, 2017
@ghost
Copy link
Author

ghost commented Nov 6, 2017

这个确实是使用Upload的时候才出现的,我上传图片都没问题

@yesmeck
Copy link
Member

yesmeck commented Nov 6, 2017

It will be better if you read smart questions(提问的智慧). We will reopen it if you can provide enough information.

@ghost
Copy link
Author

ghost commented Nov 6, 2017

自己的控件的问题不去找,亦或是官网提供的api说的不明白,这些不去处理,为啥我换了方案,直接用input type=file上传就没问题,在这里纠结这个,有意思吗?我已经按照那个fileList受控方案去做了,上传不了,你们倒是推到oss人家头上,厉害,佩服!

@yesmeck
Copy link
Member

yesmeck commented Nov 6, 2017

你要提供有用的信息我才能帮你。

@ghost
Copy link
Author

ghost commented Nov 6, 2017

onChange方法里面,监听状态,先是uploading,最后面变成error,搞不明白的就是为啥会跑到我当前页面去post,结果就是500了,这时候还没有进行任何后台相关的操作,只是上传,最后获取地址而已,我看了一下,问题就在onChange方法里面,但是不知道是什么问题

@afc163
Copy link
Member

afc163 commented Nov 6, 2017

建议有空阅读下 提问的智慧如何有效地报告 bug。抱怨和发泄情绪并不能帮助到彼此,这也是 http://new-issue.ant.design/ 存在的意义。

@ghost
Copy link
Author

ghost commented Nov 6, 2017

@afc163 我是按照你给别人回到的#2423,这个上面来处理的,在onChange方法里面一直都是setState,fileList的,action和data里面,我取的是和图片上传一样的uploadParams,这个是拿的oss的上传签名和接口相关的,图片是可以上传的,证明这边是没问题的,就是不知道excel上传,我打的日志,第一次上传,status是uploading,uploading,error,而后我再点击一次,就是成功的,并且可以传到oss上了,就是不知道为啥第一次不能成功

@afc163
Copy link
Member

afc163 commented Nov 6, 2017

去这里 http://new-issue.ant.design/ 建个新的 issue 吧,最好给出可重现可运行的 codepen 或者 GitHub repo,方便重现、确认问题和调试。(你楼顶提供的 codepen 都不能运行)

@missMHWGO
Copy link

@sunhoudong 请问楼主解决了吗?能请教下是怎么解决的吗?

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

No branches or pull requests

4 participants