微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

从 formData 上传许多文件列表

如何解决从 formData 上传许多文件列表

嗨,我想上传很多文件并推入数组

        $cor = [68.4632557093602,28.715530938537317];
        $cor1 = [ 94.3909900843602,28.56125448653838];
        $cor2 = [93.5999744593602,15.31161517706943 ];
        $cor3 = [66.0902088343602,14.462218496054646 ];
        $cor4 = [68.4632557093602,28.715530938537317];

                  $bars = modelname::where('location','geoWithin',[
                    '$geometry' => [
                        'type' => 'polygon','coordinates' => [
                            [
                               $cor,$cor1,$cor2,$cor3,$cor4
                            ],],])->count();
  echo $bars ;

我从 debugg 得到这样的

    many_image_data = []  ===> take images from input 

    images_many = [] ===> for save many FileList 

    add_Images() { when i click on button i can upload more files
    this.images_many.push({images:this.many_image_data});
  }



send_filelist(){
    const formData: FormData = new FormData();

console.log(this.images_many)

 for (let im of this.images_many) {
          formData.append('file2',im.images)
    }
}

和后端的问题请求(文件:[对象:空原型] {})

这意味着我得到了 req.body 并且他给我的不是真的

0: {images: FileList} have many files
1: {images: FileList} have many files
length: 2

应该是 req.files

我无法从请求中提取数据文件

我希望我的解释是好的和帮助

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。