How to Upload file and the metadata of the document library properties using spfx react

New Contributor

I have create the spfx react webpart to to upload the the files and the metatdata of the document library but when i post the columns using the sphttprequest i have facing the issue of error 500 and throw a messeage To add an item to a document library, use SPFileCollection.Add() . please help me to resolve the iisue or any other solution to upload a document and create  metadata of document


Image sequence :

  1. Create the document Library 
  2. Api response 
  3. Webpart Structure
  4. Upload buttons
  5. function write in the code 
  6. console error

any other  solution to perform CRUD Operation perform on document Library suggest me

created document librarycreated document libraryresponse of apiresponse of apicertificate webpartcertificate webpartupload and submit buttonupload and submit buttonwrite the create function in spfx reactwrite the create function in spfx reactError in consoleError in console 

2 Replies



Below is sample for File Upload using SPFx+React. You can get some idea from here.


Hope it will helpful to you and if so then Please mark my response as Best Response & Like to help others in this community

best response confirmed by Aniket_Sannake1345 (New Contributor)
Thanks @kalpeshvaggela i can upload file but document library properties also I want to create

You have any crud operation on document library