From c9cb5ae48def4e4b1a1a6c1d951057dfe1f68f34 Mon Sep 17 00:00:00 2001 From: Shreyas Ganta Date: Fri, 9 Nov 2018 08:57:58 -0600 Subject: [PATCH] bug fix: The change in document library selection was not reflected in the FileUpload component. This has been fixed by making sure the eventhandlers on dropzone component used the parent FileUpload component property for listname (#653) --- .../src/webparts/fileUpload/components/FileUpload.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/react-file-upload/src/webparts/fileUpload/components/FileUpload.tsx b/samples/react-file-upload/src/webparts/fileUpload/components/FileUpload.tsx index de39e75e4..e1ac602ff 100644 --- a/samples/react-file-upload/src/webparts/fileUpload/components/FileUpload.tsx +++ b/samples/react-file-upload/src/webparts/fileUpload/components/FileUpload.tsx @@ -46,11 +46,11 @@ export default class FileUpload extends React.Component { processing: function (file, xhr) { if(_fileUploadTo=="DocumentLibrary") - myDropzone.options.url = `${_context.pageContext.web.absoluteUrl}/_api/web/Lists/getById('${_listName}')/rootfolder/files/add(overwrite=true,url='${file.name}')`; + myDropzone.options.url = `${_context.pageContext.web.absoluteUrl}/_api/web/Lists/getById('${_parent.props.listName}')/rootfolder/files/add(overwrite=true,url='${file.name}')`; else { if(_itemId) - myDropzone.options.url = `${_context.pageContext.web.absoluteUrl}/_api/web/lists/getById('${_listName}')/items(${_itemId})/AttachmentFiles/add(FileName='${file.name}')`; + myDropzone.options.url = `${_context.pageContext.web.absoluteUrl}/_api/web/lists/getById('${_parent.props.listName}')/items(${_itemId})/AttachmentFiles/add(FileName='${file.name}')`; else alert('Item not found or query string value is null!') } @@ -76,7 +76,7 @@ export default class FileUpload extends React.Component { }; return ( -
Drop files here or click to upload.
+
Drop files here or click to upload.
); }