Skip to content
Discussion options

You must be logged in to vote

@mohannadwahmad17 The backend relies on parentId to know which folder the file should be placed into. By default, the request only includes the file data itself — it won’t automatically include any folder context. That’s why you need to explicitly attach the parentId when uploading.

The FileManager component provides a callback you can use to customize what metadata gets sent with the file upload request. In your case, you’ll want to send the parentId of the folder where the file should go. Whatever object you return in this callback will be appended to the file upload request in the FormData.

const handleFileUploading = (file, parentFolder) => {
  return { parentId: parentFolder?._id };
};

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Saifullah-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants