# wx.miniapp.shareFile
This interface is used to share any files to other apps (such as WeChat)
Android SDK >= 1.3.24iOS SDK >= 1.3.26
# Dxplaination of conditions
- Other App: It has been implemented.Select another application to open the fileFunctional App
- Arbitrary file: refers to the implementation of theSelect another application to open the fileFunctional App Supported file types are configured
For example, a App Support not yet availableSelect another application to open the file, then your App Generated the PDF File, you cannot select a App Open it.
# Interface details
# parameter
attribute | type | Default value | Required | Introductions |
---|---|---|---|---|
filePath | string | yes | Support local path only. | |
success | function | yes | Successful callback after getting |
# Return parameter
attribute | type | Introductions |
---|---|---|
Errcode | number | Error code |
errmsg | string | Error message |
# JSAPI Examples of code
wx.downloadFile({
url: 'https://dldir1.qq.com/WechatWebDev/test/redhood/test.docx',
filePath: wx.env.USER _DATA_PATH + '/test.docx',
success(res) {
console.log('download File success', res)
console.log('share file')
wx.miniapp.shareFile({
filePath: res.filePath,
success(res) {
console.log('share File success', res)
},
fail(res) {
console.log('share File fail', res)
}
})
},
fail(res) {
console.log('download File fail', res)
}
})