Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ customRequest callback is passed an object with:

abort(file?: File) => void: abort the uploading file

showOpenFilePicker() => void: open file picker

## License

rc-upload is released under the MIT license.
4 changes: 4 additions & 0 deletions src/AjaxUploader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ class AjaxUploader extends Component<UploadProps> {
this.reset();
};

showOpenFilePicker = () => {
this.fileInput?.click();
};

onClick = (e: React.MouseEvent<HTMLDivElement> | React.KeyboardEvent<HTMLDivElement>) => {
const el = this.fileInput;
if (!el) {
Expand Down
4 changes: 4 additions & 0 deletions src/Upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ class Upload extends Component<UploadProps> {
this.uploader.abort(file);
}

showOpenFilePicker() {
this.uploader.showOpenFilePicker();
}

saveUploader = (node: AjaxUpload) => {
this.uploader = node;
};
Expand Down