diff --git a/config/config.sample.php b/config/config.sample.php
index ffdce5cc2d534677a205fbd6cf805718a1d24e52..c5f2f14e03178b2307d67aa8e9d72e1e4ba4f7f0 100644
--- a/config/config.sample.php
+++ b/config/config.sample.php
@@ -976,6 +976,14 @@ $CONFIG = array(
  */
 'cache_path' => '',
 
+/**
+ * TTL of chunks located in the cache folder before they're removed by
+ * garbage collection (in seconds). Increase this value if users have
+ * issues uploading very large files via the ownCloud Client as upload isn't
+ * completed within one day.
+ */
+'cache_chunk_gc_ttl' => 86400, // 60*60*24 = 1 day
+
 /**
  * Using Object Store with ownCloud
  */
diff --git a/lib/private/legacy/filechunking.php b/lib/private/legacy/filechunking.php
index f2cef27545895ffabd28382a764f5389199db9d9..9b8a5a6f7661e59d462a4417822cdff925530fd4 100644
--- a/lib/private/legacy/filechunking.php
+++ b/lib/private/legacy/filechunking.php
@@ -31,6 +31,13 @@ class OC_FileChunking {
 	protected $info;
 	protected $cache;
 
+	/**
+	 * TTL of chunks
+	 *
+	 * @var int
+	 */
+	protected $ttl;
+
 	static public function decodeName($name) {
 		preg_match('/(?P<name>.*)-chunking-(?P<transferid>\d+)-(?P<chunkcount>\d+)-(?P<index>\d+)/', $name, $matches);
 		return $matches;
@@ -41,6 +48,7 @@ class OC_FileChunking {
 	 */
 	public function __construct($info) {
 		$this->info = $info;
+		$this->ttl = \OC::$server->getConfig()->getSystemValue('cache_chunk_gc_ttl', 86400);
 	}
 
 	public function getPrefix() {
@@ -67,7 +75,7 @@ class OC_FileChunking {
 	public function store($index, $data) {
 		$cache = $this->getCache();
 		$name = $this->getPrefix().$index;
-		$cache->set($name, $data);
+		$cache->set($name, $data, $this->ttl);
 
 		return $cache->size($name);
 	}