Skip to content

Commit d94d644

Browse files
authored
feat: support name prop (#574)
1 parent aa2e1dd commit d94d644

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/AjaxUploader.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ class AjaxUploader extends Component<UploadProps> {
269269
classNames = {},
270270
disabled,
271271
id,
272+
name,
272273
style,
273274
styles = {},
274275
multiple,
@@ -307,6 +308,7 @@ class AjaxUploader extends Component<UploadProps> {
307308
<input
308309
{...pickAttrs(otherProps, { aria: true, data: true })}
309310
id={id}
311+
name={name}
310312
disabled={disabled}
311313
type="file"
312314
ref={this.saveFileInput}

src/Upload.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ class Upload extends Component<UploadProps> {
1111
prefixCls: 'rc-upload',
1212
data: {},
1313
headers: {},
14-
name: 'file',
1514
multipart: false,
1615
onStart: empty,
1716
onError: empty,

tests/uploader.spec.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ describe('uploader', () => {
152152
expect(container.querySelector('input')!.id).toBe('bamboo');
153153
});
154154

155+
// https://github.com/ant-design/ant-design/issues/50643
156+
it('with name', () => {
157+
const { container } = render(<Upload name="bamboo" />);
158+
expect(container.querySelector('input')!.name).toBe('bamboo');
159+
});
160+
155161
it('should pass through data & aria attributes', () => {
156162
const { container } = render(
157163
<Upload

0 commit comments

Comments
 (0)