Skip to content

Commit

Permalink
fix chunked upload (#430)
Browse files Browse the repository at this point in the history
  • Loading branch information
life-style-de authored Feb 9, 2024
1 parent 2e032ca commit e09a199
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
3 changes: 2 additions & 1 deletion UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Upgrade Notes

## 5.0.4
- Add Additional HrefTransformer validation for `$type` and `$id` [patkul0](https://github.com/dachcom-digital/pimcore-formbuilder/pull/434)
- Add Additional HrefTransformer validation for `$type` and `$id` [@patkul0](https://github.com/dachcom-digital/pimcore-formbuilder/pull/434)
- Fix chunked upload `$type` and `$id` [@life-style-de](https://github.com/dachcom-digital/pimcore-formbuilder/pull/430)

## 5.0.3
- Fix element type check in api channel [#423](https://github.com/dachcom-digital/pimcore-formbuilder/issues/423)
Expand Down
15 changes: 5 additions & 10 deletions src/Stream/FileStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,13 @@ public function combineChunks(array $options = []): array
$uuid = $mainRequest->request->get($options['uuid']);
$fileSafeName = $this->getSafeFileName($options['fileName']);

$totalParts = $mainRequest->request->has($options['totalChunkCount']) ? (int) $mainRequest->request->get($options['totalChunkCount']) : 1;

$tmpStream = tmpfile();
for ($i = 0; $i < $totalParts; $i++) {
$chunkFiles = $this->formBuilderChunkStorage->listContents($uuid);

$chunkFiles = $this->formBuilderChunkStorage->listContents($uuid);

foreach ($chunkFiles as $chunkFile) {
$chunkPathResource = $this->formBuilderChunkStorage->readStream($chunkFile->path());
stream_copy_to_stream($chunkPathResource, $tmpStream);
fclose($chunkPathResource);
}
foreach ($chunkFiles as $chunkFile) {
$chunkPathResource = $this->formBuilderChunkStorage->readStream($chunkFile->path());
stream_copy_to_stream($chunkPathResource, $tmpStream);
fclose($chunkPathResource);
}

try {
Expand Down

0 comments on commit e09a199

Please sign in to comment.