Downloads not working properly for large files

Hey community,
since I am new to owncloud I dunno how I can provide more information you might need. So this is all I got:

I am able to upload files to my raspberryPi running owncloud. I mean its not giving any errors and I see their proper filesize. But when I want to download them via the WebInterface the download starts and finishes in like 0.5 seconds. The actual file size of the downloaded file is 0 Bytes.

I am running owncloud 10.4 version on a raspberryPi 3B
Everything is running fine except the downloading of large files.
Files bigger than around 2 GB fail to download. It doesnt matter which file type.

Hope someone can help me.

Greetings from germany


You need to adjust the timeouts in the php.ini file.

I think you are getting those timeouts and the download stops.

Hey dmitry, thank you for your post. I already tried this fix before.
I finally got into the owncloud thing and had a look at the logs.
Logs say that a php file had a bad line.
Maybe I am not the only one so let me explain it:

The log said:

"message":"stream_copy_to_stream() expects parameter 3 to be integer , string given at \/var\/www\/html\/owncloud\/lib\/composer\/sabre\/http\/lib\/Sapi.php#78"

I found the following code not doing what it should:

$contentLength = $response->getHeader('Content-Length');
if ($contentLength !== null) {
$output = fopen('php://output', 'wb');
if (is_resource($body) && get_resource_type($body) == 'stream') {
stream_copy_to_stream($body, $output, $contentLength);

contentLength migh not be an integer, so I converted it via this command to an integer:

$contentLength = intval($contentLength);

Eh voila, all downloads are working right now.

Thank you for your reply, I am glad that it works for you.

Could you help me where I can put this line exactly in the file sapi.php

Thanks in advance


i did a short research based on and it seems the upcoming ownCloud 10.3.0 release is now using the version 5.0.0 of this 3rdparty library which includes this fix.

1 Like

I have the same issue.

Please can you tell me how to modify these files ?

Thank you.


I have 152GB folder on owncoud website. When I want to download (by clicking on … then Download), it keeping spinning and then does nothing. Smaller files download ok. How can I download huge folders pls?

The actual reason for downloading is the search facility on Top right of webpage doesnot work well. So, if I searched for a word “Phase”, then I’ll have 30 hits. If I click on one hit, then the website will take me there, and I’ll lose all others, and I need to search again and click 2nd hit, and so on! Shocking… If this problem can be solved, then I donot need to download the huge 152GB folder.

Have you ever thought about what needs to happen on the server for this to work properly?
When you click on this button this is creating zip or tar archive with the contents of the folder.

  • How long would it take to generate a tar/zip of this size? Hint: timeouts
  • Where is it being saved during and after creation, for you to download it? Hint: check your PHP temp folder configuration

I agree this workflow could be a little better, however, have you ever thought about opening your search results in a new tab? (middle mouse click or shift click or right click “open in a new tab”)

1 Like