Skip to content

Commit 1aa341d

Browse files
committed
fix: Dropzone: fix add custom params when sending
1 parent 1506d10 commit 1aa341d

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/components/DropZone.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export interface DropZoneProps {
3737
uploadSuccessCallback?: (files: FileList) => boolean,
3838
uploadErrorCallback?: (files: FileList, error: string) => boolean,
3939
addCallBack? : () => void,
40-
dropzoneParams: any
40+
dropzoneParams: Map<string, any>
4141
}
4242

4343
const initialDropzoneParameter = {
@@ -92,8 +92,7 @@ export const DropZone = React.forwardRef<HTMLFormElement, DropZoneProps>(
9292
chunking : chunking == "1" ?? false,
9393
chunkSize : chunkSize != "" ? Number.parseInt(chunkSize) : 2000000,
9494
retryChunks: true,
95-
url: url,
96-
params: {...dropzoneParams}
95+
url: url
9796
};
9897

9998
const processQueue: React.MouseEventHandler<HTMLButtonElement> = () => {
@@ -229,6 +228,12 @@ export const DropZone = React.forwardRef<HTMLFormElement, DropZoneProps>(
229228
formData.append('dztotalfilesize', file.size );
230229
formData.append('dzchunksize', dropZoneParameter.chunkSize.toString());
231230
}
231+
232+
if(dropzoneParams) {
233+
for (const [key, value] of Object.entries(dropzoneParams)) {
234+
formData.append(key, value)
235+
}
236+
}
232237
}
233238

234239
}

0 commit comments

Comments
 (0)