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 file failed with error: "framesToPop":1,"code":"EUNSPECIFIED" #8

Closed
ghost opened this issue Jul 13, 2018 · 7 comments
Closed

Comments

@ghost
Copy link

ghost commented Jul 13, 2018

configuration:
const AliOSS = {
    endpoint: 'oss-cn-hongkong.aliyuncs.com',
    config: {
        maxRetryCount: 3,
        timeoutIntervalForRequest: 30,
        timeoutIntervalForResource: 24 * 60 * 60
    },
    securityToken: '', // get from server
    accessKey: '',
    secretKey: '',
};

...

AliyunOSS.enableDevMode();
AliyunOSS.initWithSecurityToken(r.securityToken, r.accessKeyId, r.accessKeySecret, AliOSS.endpoint, AliOSS.config)
AliyunOSS.addEventListener('uploadProgress', (p) => {
	let per = parseInt(p.currentSize / p.totalSize * 10);
	if (per !== logCount) {
		logCount = per;
		JLLog('uploadProgress ' + per);
	}
});
use like this :
AliyunOSS.asyncUpload('bwoil-file', 'jonglim/hand-test' + rendom++, source[0].uri).then((res) => {
	JLLog({ AliyunOSS: res })
}).catch((error) => {
	JLLog({ AliyunOSS: error })
})
log
07-13 17:18:14.924  7028 12904 I ReactNativeJS: >> NewPostScreen.js << uploadProgress 1
07-13 17:18:14.932  7028 12904 I ReactNativeJS: >> NewPostScreen.js << uploadProgress 2
...
07-13 17:18:14.966  7028 12904 I ReactNativeJS: >> NewPostScreen.js << uploadProgress 9
07-13 17:18:14.970  7028 12904 I ReactNativeJS: >> NewPostScreen.js << uploadProgress 10
07-13 17:18:15.019  7028 12904 I ReactNativeJS: >> NewPostScreen.js << {"AliyunOSS":{"framesToPop":1,"code":"EUNSPECIFIED"}}

Anyone know what's wrong with this?

@luozhang002
Copy link
Collaborator

luozhang002 commented Jul 16, 2018

@LinZh107 1. 请确认采取的是1.0.0-alpha.5的版本。(2)android端吗?(3)你代码里这个东西 'jonglim/hand-test' + rendom++ 是什么格式

@ghost
Copy link
Author

ghost commented Jul 16, 2018

@luozhang002 你好,

  1. 是1.0.0-alpha.5的版本,android端,ios还没试
  2. 第二个参数 ['jonglim/hand-test' + rendom++] 最终会是拼接成jonglim/hand-test9527 之类的字符串
  3. 初始化 initWithSecurityToken 的其他参数都是后台返回的,asyncUpload 的第三个参数是手机本地文件路径,

依照打印log来看是不是说有上传了? (感觉上传一张手机screenshot还是要了好几秒的~)

@luozhang002
Copy link
Collaborator

luozhang002 commented Jul 16, 2018

uploadProgress看log你好像是有进度的,说明回调走了,应该是上传中,可以看你的bucket上看上有没有上传成功。你的那个手机本地路径是file:///开头的吗?环境操作的时候是模拟器还是真机

@luozhang002
Copy link
Collaborator

你读取本地文件的时候用的是react native的那个库,这个报错我react -native一下framesToPop":1,"code":"EUNSPECIFIED @itinance/react-native-fs#355 @https://github.com/idehub/react-native-billing/issues/47

@GeekStyle
Copy link

token 的权限和 所建目录的权限不匹配

@ghost
Copy link
Author

ghost commented Jul 16, 2018

@luozhang002 用真机跑的,文件路径是file:///开头, component 可以正常显示照片。

PS: 上传成功了。

原来是第二个参数'objectkey'没用对,这个参数实际是文件‘folder/filename’这样的结构,而且folder是后台管理的,只能多选一。可是关于用法,好像没看到有文档说明?

@ghost ghost closed this as completed Jul 16, 2018
@luozhang002
Copy link
Collaborator

@LinZh107 React Native这个项目后期会挂到官网,现在还处于收集反馈阶段,可能文档还不全面,我这变会不定期的更新的,感谢反馈

This issue was closed.
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