How to split file when uploading to sharepoint using resumable sessions?

anna 20 Reputation points
2023-06-05T08:46:18.88+00:00

In the documentation https://learn.microsoft.com/en-us/graph/api/driveitem-createuploadsession?view=graph-rest-1.0#upload-bytes-to-the-upload-session I read:

Note: If your app splits a file into multiple byte ranges, the size of each byte range MUST be a multiple of 320 KiB (327,680 bytes). Using a fragment size that does not divide evenly by 320 KiB will result in errors committing some files.

Now what about the files which length is not a multiple of 320 KiB? Should the last part be just extended up to size of 320 KiB?

Microsoft 365 and Office SharePoint For business Windows
Microsoft Security Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2023-06-06T02:55:12.7+00:00

    Hi @anna,

    Do you want to split file when uploading to sharepoint using resumable sessions?

    Here is a test for your reference:

    User's image

    Use uploadUrl to creaete new put requestUser's image

    Check this file size:

    User's image

    In the body, choose the file. ThenAdd two headers Content-Length and Content-Range for the request.

    Content-Length : {fileSize in bytes}
    Content-Range: bytes 0-{fileSize-1}/{fileSize}

    Here is test result:

    User's image

    The problem in this thread is similar to yours, you could refer to this thread(The path in this should also solve your doubts yesterday):

    https://learn.microsoft.com/en-us/answers/questions/435652/upload-a-large-excel-file-using-createuploadsessio


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best Regards

    Cheng Feng


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.