-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PS-707 Databox basket - Multi Part upload files to Expose (#489)
- Loading branch information
Showing
5 changed files
with
157 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
lib/php/storage-bundle/Controller/MultipartUploadCancelAction.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Alchemy\StorageBundle\Controller; | ||
|
||
use Doctrine\ORM\EntityManagerInterface; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Alchemy\StorageBundle\Upload\UploadManager; | ||
use Alchemy\StorageBundle\Entity\MultipartUpload; | ||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | ||
|
||
class MultipartUploadCancelAction extends AbstractController | ||
{ | ||
public function __construct(private UploadManager $uploadManager, private EntityManagerInterface $em,) | ||
{ | ||
} | ||
|
||
public function __invoke(MultipartUpload $data, Request $request) | ||
{ | ||
try { | ||
$this->uploadManager->cancelMultipartUpload($data->getPath(), $data->getUploadId()); | ||
} catch (\Throwable $e) { | ||
// S3 storage will clean up its uncomplete uploads automatically | ||
} | ||
|
||
$this->em->remove($data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters