1
Hello all right ? I’m having problems with sending video to the server, with image (the same code practically) it sends, but not with videos. My server is a Linux Ubuntu VPS, I have the vestaCP panel to manage the Hosting.
I already gave permission chmod -R 777 to the folder and even then it does not send the video.
Follows code below.
<form name="cadastrar novos cursos" method="post" action="../backend/php/novaaula.php?id=<?php echo $uuid_curso; ?>" enctype="multipart/form-data">
<label>Nome da aula <i>*</i></label>
<input id="name" type="text" name="name" placeholder="Nome do curso" required="" autocomplete="off">
<br>
<label>Vídeo <i>*</i> (.avi .mov .mp4)</label>
<input id="file" type="FILE" name="file" required="" autocomplete="off">
<br>
<label>Escreva aqui o que aprendemos nesse aula <i>*</i></label>
<textarea id="oqueaprendemos" type="text" name="oqueaprendemos" placeholder="O que aprendemos nesse aula" required="" autocomplete="off"></textarea>
<br>
<button id="save">Cadastrar</button>
</form>
$_UP['pasta'] = '../../../portal.claudeteiwata.com.br/assets/cursos/videos/';
// Extensoes permitidas dos vídeo
$_UP['extensoesvideo'] = array('avi', 'mov', 'mp4');
// Verifica se a extensao do arquivo é compativel com as extensoes acima
$extensao = strtolower(end(explode('.', $_FILES['file']['name'])));
if (array_search($extensao, $_UP['extensoesvideo']) === false) {
header('Location: ../../registernewcourse/#errorvideo');
return;
}
// Troca o nome do arquivo para outro.
$nomefinalvideo = $uuid_file.'.'.$extensao;
if (move_uploaded_file($_FILES['file']['tmp_name'], $_UP['pasta'] . $nomefinalvideo)) {
$sqlInseriraula = mysqli_query($conexao, "INSERT INTO aulas(uuid_curso, uuid_aula, nome, oqueaprendemos, enderecovideo)
VALUES ('$uuid_curso','$uuid_aula','$nome', '$oqueaprendemos', '$nomefinalvideo')");
header('Location: ../../#certo');
}else {
// header('Location: ../../curso/#errorvideocarregar');
}