FIX: no se podia subir los videos
This commit is contained in:
@ -123,4 +123,38 @@ class Eventos {
|
||||
->withHeader('Content-Type', 'application/json')
|
||||
->withStatus(201);
|
||||
}
|
||||
public function addVideo(Request $request, Response $response, Container $container, DataHandler $handler, MediaLoader $loader, $evento): Response {
|
||||
$post = $request->getParsedBody();
|
||||
$files = $request->getUploadedFiles();
|
||||
if (count($files) == 0) {
|
||||
$output = [
|
||||
'informacion' => '',
|
||||
'evento' => $evento,
|
||||
'estado' => false
|
||||
];
|
||||
$response->getBody()->write(json_encode($output));
|
||||
return $response->withHeader('Location', implode('/', [
|
||||
$container->get('urls')['admin'],
|
||||
'evento',
|
||||
$evento
|
||||
]));
|
||||
}
|
||||
$file = $files['video'];
|
||||
$eventos = $handler->load('eventos');
|
||||
$e = $eventos[$evento];
|
||||
if (is_array($file)) {
|
||||
$status = false;
|
||||
foreach ($file as $f) {
|
||||
$status |= $loader->add($e, $f);
|
||||
}
|
||||
} else {
|
||||
$status = $loader->add($e, $file);
|
||||
}
|
||||
$response->getBody()->write(json_encode($output));
|
||||
return $response->withHeader('Location', implode('/', [
|
||||
$container->get('urls')['admin'],
|
||||
'evento',
|
||||
$evento
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user