发布预览:使用带有文件输入的Redux表单时的blob而不是类型

时间:2017-08-19 12:23:56

标签: javascript reactjs file-upload react-redux redux-form

使用带有文件输入的Redux Forn上传文件时出错,这就是将文件发送到后端API时的样子。请注意,“预览”发送“blob”,因此后端API无法接收上载文件

{"PROJECT_ID":"6237581","SUBJECT":"test nilai UN","MESSAGE":"test nilai UN","file_upload":
[{"preview":"blob:http://localhost:8089/18dc2302-02a3-475a-9d08-e1a6ac8aabf1"}]}:

The preview of file that is sent. 这是我的组件

export class ReduxFileInput extends Component {
  render(){
    return(
      <FileInput
        name={this.props.name}
        placeholder={this.props.placeholder}
        accept=".zip,.doc,.docs,.docx,.xls,.pdf,.xlsx,.jpg,.jpeg,.png"
        onDrop={(event)=> this.props.input.onDrop(event.target.files[0])}
        {...this.props.custom}
        >
      </FileInput>
    )
  }
}

这是我的redux表格

               <Field
                  inputName="EVIDENCE"
                  name="file_upload"
                  type='file'
                  component = {ReduxFileInput}                  
                />

0 个答案:

没有答案