我如何使用sweetalert2上传多个文件

问题描述 投票:0回答:1

我要上传多个文件,此代码仅选择一个文件进行上传

const { value: file } = await Swal.fire({
  title: 'Select image',
  input: 'file',
  inputAttributes: {
    'accept': 'image/*',
    'aria-label': 'Upload your profile picture'
  }
})

Codepen link

javascript jquery sweetalert sweetalert2
1个回答
1
投票

您需要在输入中添加multiple

const { value: file } = await Swal.fire({
  title: 'Select image',
  input: 'file',
  inputAttributes: {
    'accept': 'image/*',
    'multiple': 'multiple', 
    'aria-label': 'Upload your profile picture'
  }
})
© www.soinside.com 2019 - 2024. All rights reserved.