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

图片上传的时候想用二进制 #135

Open
ghost opened this issue Aug 11, 2018 · 3 comments
Open

图片上传的时候想用二进制 #135

ghost opened this issue Aug 11, 2018 · 3 comments

Comments

@ghost
Copy link

ghost commented Aug 11, 2018

默认的是base64 , 如何得到二进制数据然后上传?新加一个按钮,点按钮再上传图片,如何拿到压缩后的图片数据?

@ghost
Copy link
Author

ghost commented Aug 13, 2018

正常上传了,上传后返回的链接怎么插到内容里面?

@yangyongguan
Copy link

image: {
sizeLimit: 512 * 1024,
compress: null,
uploadHandler (responseText) {
var json = JSON.parse(responseText)
if (json.code !== 200) {
console.error(json.msg)
} else {
if (json.data.host.indexOf('http') !== 0) {
return 'https://' + json.data.host + '/' + json.data.name
}
return json.data.host + '/' + json.data.name
}
},
upload: {
url: '/api/upload/image',
headers: {},
params: {},
fieldName: 'file'
}
},

@yangyongguan
Copy link

在uploadHandler 回调里面拿到服务器返回的数据自己处理

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

1 participant