Skip to content

Commit

Permalink
[Scorm] fixes file upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Elorfin committed Mar 13, 2024
1 parent daa877c commit 783204c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/plugin/scorm/Manager/ScormManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use Ramsey\Uuid\Uuid;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\UploadedFile;

class ScormManager
{
Expand Down Expand Up @@ -99,18 +98,18 @@ public function unzipScormArchive(Workspace $workspace, File $file, $hashName)
$zip->close();
}

private function generateScorm(Workspace $workspace, UploadedFile $file)
private function generateScorm(Workspace $workspace, File $file)
{
$ds = DIRECTORY_SEPARATOR;
$fileName = $file->getClientOriginalName();
$hashName = Uuid::uuid4()->toString().'.zip';
$scormData = $this->parseScormArchive($file);
$this->unzipScormArchive($workspace, $file, $hashName);
// Move Scorm archive in the files directory
$finalFile = $file->move($this->filesDir.$ds.'scorm'.$ds.$workspace->getUuid(), $hashName);

return [
'name' => $fileName, // to follow standard file data format
'name' => method_exists($file, 'getClientOriginalName') ? $file->getClientOriginalName() : $file->getFilename(), // to follow standard file data format

'type' => $finalFile->getMimeType(),
'size' => filesize($finalFile),
'url' => $hashName,
Expand Down

0 comments on commit 783204c

Please sign in to comment.