diff --git a/lib/private/filechunking.php b/lib/private/filechunking.php
index ece215e734494122c6060c3a4fd2d290888de384..32cbb7559f0ae2c8ae5124f4a0e408383d35226f 100644
--- a/lib/private/filechunking.php
+++ b/lib/private/filechunking.php
@@ -74,14 +74,16 @@ class OC_FileChunking {
 
 	public function isComplete() {
 		$prefix = $this->getPrefix();
-		$parts = 0;
 		$cache = $this->getCache();
-		for($i=0; $i < $this->info['chunkcount']; $i++) {
-			if ($cache->hasKey($prefix.$i)) {
-				$parts ++;
+		$chunkcount = (int)$this->info['chunkcount'];
+
+		for($i=($chunkcount-1); $i >= 0; $i--) {
+			if (!$cache->hasKey($prefix.$i)) {
+				return false;
 			}
 		}
-		return $parts == $this->info['chunkcount'];
+
+		return true;
 	}
 
 	/**