How to use Ant Design Upload component it's not sending anything

Viewed 1043

I'm trying to use the Upload component

<Upload
  action="//localhost:3001/api/v1/file/upload"
  listType="picture-card"
  fileList={fileList}
  onPreview={this.handlePreview}
  onChange={this.handleChange}
>

but on the endpoint API I receive nothing when I select the file to upload.

1 Answers

Would you try this? I think both '//' will not evaluate to your localhost endpoint, try either ommiting that or doing 'http://' or 'https://'

<Upload
  action="localhost:3001/api/v1/file/upload"
  listType="picture-card"
  fileList={fileList}
  onPreview={this.handlePreview}
  onChange={this.handleChange}
>
Related