Forum Discussion
Not Able to Upload Files through api larger than 250 MB
Hi NeeradaSkyhigh,
you can chunk your upload into multiple parts that are smaller than 250 MB
/_api/web/getfilebyserverrelativeurl('/Path/to/file')/startupload(uploadId={a guid})
/_api/web/getfilebyserverrelativeurl('/Path/to/file')/continueupload(uploadId={your guid from above}, fileOffset={number of bytes uploaded in previous step})
/_api/web/getfilebyserverrelativeurl('/Path/to/file')/finishupload(uploadId={your guid from above}, fileOffset={total number of bytes uploaded in previous steps})
Here is an example using C#
https://sharepoint.stackexchange.com/questions/161845/using-chunked-upload-startupload-with-sharepoint-rest-api
Best Regards,
Sven
- NeeradaSkyhighMar 21, 2023Copper Contributor
Hi SvenSieverding and ganeshsanap ,
We have two operations at the files, when we are detecting violated content we copy that file into the quarantine folder and another operation is if user wants to restore the file then we upload the file in the current location again with the help of upload file API from the quarantine folder.
1.The API which is used in copying the file to quarantine is (
@POST("/_api/SP.MoveCopyUtil.CopyFile")
@Headers({"Content-Type: application/json"})) which is working fine for larger files.
2. The API for restoring the file we are using
@PUT("/{webUrl}/_api/web/GetFileByServerRelativePath(decodedurl=@relativeUrl)/$value")This is getting failed with the above error message "Size is too big...."
Since the approach you have mentioned is using 3 APIs to upload large files. Instead of that can we. use this copyFile API, if yes will this retain the versioning of files?
- ganeshsanapMar 21, 2023MVP
NeeradaSkyhigh Yes, you should be able to copy or move those files back to original folder by using API.
Check this documentation for reference to see all available API endpoints: MoveCopyUtil Class
Not sure if it retains the versioning history. You can test it by trying to copy/move test files in development site.
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs