# wx.saveFile(Object object)
with Promise style call: Supported
Mini Program plugin: Not supported
Save the file locally. Note:saveFile Will move the temporary file, so the tempFilePath Will not be available
# parameter
# Object object
attribute | type | Default values | Required | Introductions |
---|---|---|---|---|
tempFilePath | string | yes | Temporary path to the file you want to save (Local path) | |
success | function | no | Interface calls the successful callback function | |
fail | function | no | Interface calls failed callback functions | |
complete | function | no | Callback function at the end of an interface call (both successful and unsuccessful calls are executed) |
# object.success callback
# parameter
# Object res
attribute | type | Introductions |
---|---|---|
savedFilePath | string | File path after storage (Local path) |
# sample code
wx.chooseImage({
success: function(res) {
const tempFilePaths = res.tempFilePaths
wx.saveFile({
tempFilePath: tempFilePaths[0],
success (res) {
const savedFilePath = res.savedFilePath
}
})
}
})
# Be careful
Local file storage is limited to the size of 10M