# wx.chooseMessageFile(Object object)

Start from base library version 2.5.0. Please remaining backward compatible.

with Promise style call: Supported

Mini Program plugin: Not supported

Select a file from the client session.

# parameter

# Object object

attribute type Default values Required Introductions Minimum version
count number yes The maximum number of files you can choose, you can 0100
type string 'all' no Type of file selected
extension Array.&ltstring&gt no Filter by filename extension, only type==file Is effective when... Each item cannot be an empty string. No filter by default. 2.6.0
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.type Legal value

value Introductions Minimum version
all Select from all files
video Video files can only be selected
image Select only picture file
file You can choose files other than pictures and videos

# object.success callback

# parameter
# Object res
attribute type Introductions
tempFiles Array.&ltObject&gt Returns an array of local temporary file objects for the selected file

res.tempFiles Structure

attribute type Introductions
path string Local temporary file path (Local path)
size number Local temporary file size, unit B
name string Selected file name
type string Selected file type
time number Session send time, Unix timestamp of selected file, tool does not support this property

type Legal value

value Introductions Minimum version
video Video file selected
image Selected picture file
file Selected files except pictures and videos
wx.chooseMessageFile({
  count: 10,
  type: 'image',
  success (res) {
    // TempFilePath can display pictures as src attribute of img tag
    const tempFilePaths = res.tempFiles
  }
})