Skip to content
This repository has been archived by the owner on Aug 22, 2022. It is now read-only.

如何触发uploadError #361

Open
mice33 opened this issue Aug 1, 2014 · 5 comments
Open

如何触发uploadError #361

mice33 opened this issue Aug 1, 2014 · 5 comments

Comments

@mice33
Copy link

mice33 commented Aug 1, 2014

按照示例构建上传代码和PHP接收代码.
只要PHP文件存在,不管文件上传成功与否都会触发uploadSuccess事件(如PHP文件清空只输出123也行..)
PHP应该如何反馈代码,触发uploadError事件,或者是在JS里写?
已经看了几遍api了...

@2betop
Copy link
Contributor

2betop commented Aug 1, 2014

再看看 faq 里面的这个:#136

@mice33
Copy link
Author

mice33 commented Aug 1, 2014

3Q...同求可以把这个放在快速入门的demo里面..

@mice33
Copy link
Author

mice33 commented Aug 1, 2014

uploadAccept 返回 error{server}
server 这个能自定义吗?或者我想区分具体情况应该如何写?
比如 返回server1 就是服务器出错什么的..

@2betop
Copy link
Contributor

2betop commented Aug 1, 2014

默认这里面 return false, file 都是标记为错误,且错误类型是 server. 如果你想把 error 错误类型改成 server2

uploader.on( 'uploadAccept', function( file, response, reject ) {
    if ( hasError ) {
        reject('server2');
    }
});

@mice33
Copy link
Author

mice33 commented Aug 1, 2014

3Q 看来API 还没写完全哦

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

No branches or pull requests

2 participants