Fixed saveFile not working for default storage
parent
fca0537a4d
commit
0ee4cc57fc
|
@ -265,9 +265,13 @@ class H5PDefaultStorage implements \H5PFileStorage {
|
||||||
* @param int $contentid
|
* @param int $contentid
|
||||||
*/
|
*/
|
||||||
public function saveFile($file, $contentId) {
|
public function saveFile($file, $contentId) {
|
||||||
$path = $this->path . '/' . ($contentId === 0 ? 'editor' : 'content') . '/' . $file->getType() . 's/' . $file->getName();
|
// Prepare directory
|
||||||
|
$path = $this->path . '/' . (empty($contentId) ? 'editor' : 'content/' . $contentId) . '/' . $file->getType() . 's';
|
||||||
self::dirReady($path);
|
self::dirReady($path);
|
||||||
|
|
||||||
|
// Add filename to path
|
||||||
|
$path .= '/' . $file->getName();
|
||||||
|
|
||||||
$fileData = $file->getData();
|
$fileData = $file->getData();
|
||||||
if ($fileData) {
|
if ($fileData) {
|
||||||
file_put_contents($path, $fileData);
|
file_put_contents($path, $fileData);
|
||||||
|
|
Loading…
Reference in New Issue