Skip to content

Commit

Permalink
Merge pull request #160 from Kunstmaan/fix_empty_name
Browse files Browse the repository at this point in the history
use original filename when no name is provided when uploading a file
  • Loading branch information
Wim Vandersmissen committed Aug 20, 2014
2 parents f6b4c19 + 16475a5 commit dcef8c4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Helper/File/FileHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ public function prepareMedia(Media $media)
}
if ($content instanceof UploadedFile) {
$media->setOriginalFilename($content->getClientOriginalName());
$name = $media->getName();
if (empty($name)) {
$media->setName($media->getOriginalFilename());
}
}

$media->setFileSize(filesize($media->getContent()));
Expand Down

0 comments on commit dcef8c4

Please sign in to comment.