Forum Discussion
SharePoint file upload using API
- Mar 22, 2019
Pulak2409 Multiple APIs to do this.
REST API https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-folders-and-files-with-rest
You can also use CSOM using FileCreationInformation https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/upload-large-files-sample-app-for-sharepoint
You have the option to overwrite files in both scenarios
Hey Pulak2409 ,
I recommend you use PnPJs, since it makes handling REST calls a lot easier for you. https://github.com/SharePoint/PnP-JS-Core/wiki/Working-With:-Files page shows how to work with files using it. A good point is that, after uploading the file, you may want to update it to set the Title of the Item you just created. Here is a piece of my code, which uploads from an input button. Any problem, let me know!