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
22 changes: 20 additions & 2 deletions src/AjaxUploader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,26 @@ class AjaxUploader extends Component<UploadProps> {
}
}

uploadFiles = (files: File[]) => {
const originFiles = [...files] as RcFile[];
cacheFiles = async (files: File[]) => {
if (files?.length) {
const cachedFiles = await Promise.all(
files.map(async file => {
const buffer = await file.arrayBuffer();
return new File([buffer], file.name, {
type: file.type,
lastModified: file.lastModified,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other file attributes would be lost.

Copy link
Contributor Author

@divyeshagrawal divyeshagrawal Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot from 2025-12-13 19-54-43

I’ve attached a screenshot after printing the original and cloned File objects, and I don’t see any difference in their attributes. Please let me know if I’m missing something.

});
}),
);

return cachedFiles;
}

return [];
};

uploadFiles = async (files: File[]) => {
const originFiles = (await this.cacheFiles(files)) as RcFile[];
const postFiles = originFiles.map((file: RcFile & { uid?: string }) => {
// eslint-disable-next-line no-param-reassign
file.uid = getUid();
Expand Down
Loading