-
-
Notifications
You must be signed in to change notification settings - Fork 54.2k
Open
react-component/upload
#685Labels
help wantedThe suggestion or request has been accepted, we need you to help us by sending a pull request.The suggestion or request has been accepted, we need you to help us by sending a pull request.
Description
Reproduction link
https://ant.design/components/upload
Steps to reproduce
When using the Ant Design Upload or Dragger component, files that exist only in cloud storage (OneDrive, iCloud, Google Drive) automatically get status: "error" and cannot be uploaded.
- Use Ant Design Upload or Dragger component.
- Select a file that exists only in cloud storage (e.g., OneDrive, iCloud, Google Drive).
On Android devices, this can happen when selecting a file directly from the cloud picker.
What is expected?
The file should be uploaded normally or a proper error notification should be shown.
The file should not get stuck in status: "error" automatically.
What is actually happening?
- The file immediately gets status: "error".
- The upload does not proceed, and onChange shows the file as failed.
| Environment | Info |
|---|---|
| antd | 5.28.1 |
| React | 18.3.1 |
| System | Windows 11 |
| Browser | Latest Chrome |
Proposed solution:
To handle cloud-only files, read the file fully into memory and create a new File object before uploading:
const buffer = await file.arrayBuffer();
const clone = new File([buffer], file.name, { type: file.type });
return clone; // upload this clone insteadThis ensures that cloud-only files are treated as real File objects and prevents the automatic status: "error" state.
dosubot
Metadata
Metadata
Assignees
Labels
help wantedThe suggestion or request has been accepted, we need you to help us by sending a pull request.The suggestion or request has been accepted, we need you to help us by sending a pull request.