关于wx.uploadFile 上传的接口 我怎么上传多张图片

function addUploadfile ( cb ) {
     GetToken ( function ( restoken ) {
         wx.chooseImage ( {
             count : 9 , / / 默认 9 
             sizeType : ['original' , 'compressed'] , / / 可以指定是原图还是压缩图,默认二者都有 
             sourceType : ['album' , 'camera'] , / / 可以指定来源是相册还是相机,默认二者都有 
             success : function ( res ) {
                 var tempFilePaths = res.tempFilePaths
                 for ( var i = 0 ; i < tempFilePaths.length; i + + ) {
                     wx.uploadFile ( {
                         url : url ,
                         filePath : tempFilePaths ,
                         name : ' file ' ,
                         success : function ( res ) {
                             var data = JSON.parse ( res. data ) ;
                             console. log ( "图片:" + data . data ) ;
                             return typeof cb = = "function" & & cb ( data , rootDocment )
                         }
                     } ) ;
                 }
             }
         } ) ;
     } ) ;
}

你可能感兴趣的:(微信小程序)