微信小程序API文件,wx.saveFile保存文件到本地
wx.saveFile(OBJECT)
保存文件到本地。
OBJECT參數說明:
| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
| tempFilePath | String | 是 | 需要保存的文件的臨時路徑 |
| success | Function | 否 | 返回文件的保存路徑,res = {savedFilePath: '文件的保存路徑'} |
| fail | Function | 否 | 接口調用失敗的回調函數 |
| complete | Function | 否 | 接口調用結束的回調函數(調用成功、失敗都會執(zhí)行) |
success返回參數說明:
| 參數 | 說明 |
|---|---|
| savedFilePath | 文件的保存路徑 |
示例代碼:
wx.chooseImage({
success: function(res) {
var tempFilePath = res.tempFilePath
wx.saveFile({
tempFilePath: tempFilePath[0],
success: function(res) {
var savedFilePath = res.savedFilePath
}
})
}
})
bug & tip
-
tip: 本地文件存儲的大小限制為 10M
第二部分:如何開通一個小商店


立即掃碼關注

多門店/直營/加盟連鎖管理系統(tǒng)