# React-FileUpload **Repository Path**: labike/React-FileUpload ## Basic Information - **Project Name**: React-FileUpload - **Description**: support React@16.X - **Primary Language**: JavaScript - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-10-09 - **Last Updated**: 2022-05-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # React-FileUpload upgrade support React@16.X project from https://github.com/SoAanyip/React-FileUpload #### Use if React@15.X to https://github.com/SoAanyip/React-FileUpload if React16.X 1. new file `newFileUpload.js` 2. copy `FileUpload.js` code to `newFileUpload.js` custom component content: import FileUpload from 'FileUpload' class NewFileUpload extends Component{ render(){ /*set properties*/ const options={ baseUrl:'/xxx/xxx/xxx.php', fileFieldName: 'upload_file', dataType: 'json', chooseAndUpload: true, uploadSuccess: (res) => this.props.onSuccess(res.data), uploadError: (err) => this.props.onError(err.message || '上传图片出错') } /*Use FileUpload with options*/ /*Set two dom with ref*/ return ( ) } } export default NewFileUpload