Upload a 10 GB file File into SharePoint Online

Viewed 1008

We have requirement to upload a large File, possibly 10 GB , or up to 50 GB file size into SharePoint Online.

As per the new limit here , Maximum file upload size is increased upto 250 GB.

Can we upload a large File of 10GB or 50 GB into SharePoint online using SPFX File Upload or SharePoint REST API services?

If So, Please guide me the right approach, Do we need to split the file into chunks and upload? if so, What is the maximum File Chunk size?

2 Answers

The recommended approach to have sucesfull with this requirement is use a CSOM Library: At Microsoft Docs, titled Upload large files sample SharePoint Add-in, contains useful examples that provide you to Upload large files, using C# PRogramming. Bellow contains an code example that you may use as a Console Application:

public static void UploadDocumentContent(ClientContext ctx, string libraryName, string filePath)
{
  Web web = ctx.Web;

  FileCreationInformation newFile = new FileCreationInformation();

  // The next line of code causes an exception to be thrown for files larger than 2 MB.
  newFile.Content = System.IO.File.ReadAllBytes(filePath);
  newFile.Url = System.IO.Path.GetFileName(filePath);

  // Get instances to the given library.
  List docs = web.Lists.GetByTitle(libraryName);

  // Add file to the library.
  Microsoft.SharePoint.Client.File uploadFile = docs.RootFolder.Files.Add(newFile);
  ctx.Load(uploadFile);
  ctx.ExecuteQuery();
}

At Console Application Main method, you'll call the created method above:

static void Main(string[] args)
{
 using(ClientContext ctx = new ClientContext("https://tenant.sharepoint.com/sites/business"))
 {
  ctx.Credentials =  = new SharePointOnlineCredentials("username@tenantdomain", "add secure password object");
  UploadDocumentContent(ctx, "Documents", @"C:\FileFolder\FileName.ext")
 }
}
Related