Skip to content

Commit 49fed21

Browse files
committed
Update latest versions and fix upload stream
1 parent 7bfe3ff commit 49fed21

2 files changed

Lines changed: 231 additions & 273 deletions

File tree

src/Command/UploadCommand.php

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,14 @@ private function uploadFiles(array $files, OutputInterface $output): void
8080

8181
$output->writeln("Uploading $file ({$fileSizeMB}MB)...");
8282

83-
// Dropbox simple upload limit is 150MB
84-
// Use chunked upload for files larger than 150MB
85-
$maxSimpleUploadSize = 150 * 1024 * 1024; // 150MB in bytes
86-
87-
if ($fileSize > $maxSimpleUploadSize) {
88-
$output->writeln(" Using chunked upload (file > 150MB)...");
89-
90-
$fileHandle = fopen($localFile, 'r');
91-
$client->uploadChunked($file, $fileHandle);
92-
fclose($fileHandle);
93-
} else {
94-
// Use simple upload for smaller files
95-
$output->writeln(" Using standard upload...");
96-
$client->upload($file, file_get_contents($localFile));
83+
// Open file as a stream to avoid loading entire file into memory
84+
$fileHandle = fopen($localFile, 'r');
85+
if ($fileHandle === false) {
86+
throw new \Exception("Failed to open file: $localFile");
9787
}
9888

89+
$client->upload($file, $fileHandle);
90+
9991
$output->writeln(" ✓ Upload successful");
10092
unlink($localFile);
10193
$output->writeln(" ✓ Local file deleted");

0 commit comments

Comments
 (0)