收藏
回答

小程序miniprogram-file-uploader分块上专,后端如何接收分块上传的二进制流?

小程序端:

const Uploader = require('miniprogram-file-uploader').default

if(typeof(Uploader)!=='undefined' && Uploader.isSupport()){

            wx.chooseVideo({

                sourceType:['album','camera'],

                compressed:false,

                maxDuration:60,

                camera:'back',

                success:(res)=>{

                    console.log(res)

                    const uploader = new Uploader({

                        tempFilePath:res.tempFilePath,

                        totalSize:res.size,

                        chunkSize:1024*512,

                        testChunks:false,

                        fileName:'file',

                        uploadUrl:app.www+'/Wxapp/Multiple/partFile',

                        mergeUrl:app.www+'/Wxapp/Multiple/mergeFile'

                    })

                    uploader.upload()

                    uploader.on('complete',(res)=>{

                        console.log('upload complete',res)

                    })

                    uploader.on('success',(res)=>{

                        console.log('upload success',res)

                    })

                    uploader.on('fail',(res)=>{

                        console.log('fail',res)

                    })

                    uploader.on('progress',(res)=>{

                        console.log('progress',res)

                    })

                }

            })

        }


后端:

我用了file_get_contents('php://input') $_FILES 等都无法获取二进制流




回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容