上传文件到Asp.net Core Api?

时间:2018-11-09 21:06:11

标签: javascript reactjs asp.net-core axios

我尝试了不同的方式(通过插件和自己的代码),但是我无法上传图片

@observable
  images = [];

  @action
  onDrop(files) {
    this.images = files;
  }

  <DropzoneonDrop={this.onDrop.bind(this)}>
            <p>Try dropping some files here, or click to select files to upload.</p>
 </Dropzone>


  var images = new FormData();
      images.append("1", image[0]);
      const response = yield self
      .rootStore()
      .axios.post('/Items/Post', {
        images: images
      });

[HttpPost("Post")]
public void Post(IList<IFormFile> images)

但是图像始终是一个空对象({}),该对象将被发送到服务器

0 个答案:

没有答案