From 24866bfcc1bd1affe6a5c1ce69bfe4796e3dd205 Mon Sep 17 00:00:00 2001 From: Mahesh Krishna Kumar Date: Tue, 9 Feb 2021 19:47:48 +0530 Subject: [PATCH] feat: Add name attribute to file input --- src/index.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/index.tsx b/src/index.tsx index 2cc9243..baf24ba 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -15,6 +15,7 @@ export interface CSVReaderProps { cssLabelClass?: string fileEncoding?: string inputId?: string + inputName?: string inputStyle?: object label?: string | React.ReactNode onError?: (error: Error) => void @@ -30,6 +31,7 @@ const CSVReader: React.FC = ({ cssLabelClass = 'csv-label', fileEncoding = 'UTF-8', inputId = 'react-csv-reader-input', + inputName= 'react-csv-reader-input', inputStyle = {}, label, onError, @@ -69,6 +71,7 @@ const CSVReader: React.FC = ({ className={cssInputClass} type="file" id={inputId} + name={inputName} style={inputStyle} accept={accept} onChange={e => handleChangeFile(e)} @@ -85,6 +88,7 @@ CSVReader.propTypes = { cssLabelClass: PropTypes.string, fileEncoding: PropTypes.string, inputId: PropTypes.string, + inputName: PropTypes.string, inputStyle: PropTypes.object, label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]), onError: PropTypes.func,