4

The code that I am using which successfully uploads large file(s) to on- premises SharePoint 2013 (I have uploaded 1.9 GB file using this code) is given below. This was run successfully in some computers but failed in others. The configuration in on of the computers where this code failed is Windows XP SP3 32 bit with 4GB RAM. The 1.9 GB file is not getting uploaded through browser also. I am using Visual Studio 2010 SP1.

m_ClientContext.RequestTimeout = Timeout.Infinite;
using (FileStream fs = new FileStream(m_SourceFilePath.Text, FileMode.Open))
{
    Microsoft.SharePoint.Client.File.SaveBinaryDirect(m_ClientContext, szFullFilePath, fs, true);
}

I know a part of the solution, i.e., to upload it in chunks. I have read much about this. But I am not getting a proper solution. Its been more than a week I am trying different tricks to solve this. Kindly help me in solving this problem.

Edit: The same file which I have uploaded to SharePoint 2013 in Windows Server 2008 R2 programmatically some days ago is not getting uploaded to it now. It fails to get uploaded to SharePoint 2013 through browser also in Windows Server 2008 R2.

2

Make sure that your 2010 server has increased its max upload limmit! currently the default is 50mb not 2GB.

sounds like 2013 machine was ammended to accept larger file uploads!

to change it:

  • goto central admin -> application managment -> manage web applications
  • click on the web app that you want to increase upload size
  • click on general settings drop down -> general settings -> scroll down in the popup untill you see "Maximum Upload Size" -> set to a reasonable ammount like 2250Mb for 2.2GB

forgot to mention that you need to reflect the changes within the web.config aswell!

httpRuntime executionTimeout="300" maxRequestLength="225000"

it could be that your timing out for some reason on some older legacy computers compared to others which are maybe newer?!

you could also change the chunk file size:

To set the large file chunk size to 1,073,741,824 bytes (1024 MB), use the following syntax:

stsadm -o setproperty -pn large-file-chunk-size -pv 1073741824 

To view the current setting of the large file chunk size property, use the following syntax:

stsadm -o getproperty -pn large-file-chunk-size –url http://server_name 

above requires iisreset!

what error are you getting in your uls logs? is it even getting to that point?

  • Its not 2010.I have already done the first two steps that you have typed here. I don't know how to set stsadm in SharePoint 2013. Both the links that you pointed out doesn't apply to SharePoint 2013. – talib2608 Dec 6 '13 at 12:39
  • sorry for some reason i thought it was 2010, just read your question and it does state 2013! lol manic fridays! what browser version are you using? – Ali Jafer Dec 6 '13 at 13:50
  • Its the latest chrome and latest mozilla beta version. But I have to programmatically upload the document to SharePoint. – talib2608 Dec 6 '13 at 19:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.