Estou hospedando em servidor linux para testar, e não é problema no limite de tamanho de arquivo no servidor (no servidor esta 100mb).
Acho que seria melhor usar o "move_upload_file" que esta comentado, mas não consegui fazer isto.
Se alguém souber resolver ou dar alguma opiniao talvez ate de fazer o upload multiplo do video e da imagem em apenas uma pagina ao invés de usar o "enviar_up" para enviar primeiro o video.
Outra questao é que na pagina "index" onde mostra as imagens miniaturas dos videos, não tem quebra de linha, ou seja, se voce cadastrar muitos videos ficarao tudo em uma linha. Talvez poderiamos por ainda uma paginacao.
Pergunta
MCAsite
Bom galera, estou testando um script mas não estou conseguindo fazer o upload de arquivos maiores que 2mb.
O script é do amigo Hertal que foi postado no PHPBrasil.
arquivos:
config.php
enviar_up.php
excluir_video.php
gerenciar_video.php
index.php
salvar_dados.php
upload_file.php
ver_video.php
pastas: ( n esquece do chomod)
fotos
videos
tabela mysql:
config.php enviar_up.php<? if ($_GET['erro'] == 's'){ echo "<center>Selecione um arquivo para proseguir!</center><p>"; } if ($_GET['erro'] == 'ss'){ echo "<center>Campo(s) sem preenchimento! O processo deve ser reininciado.</center><p>"; } if ($_GET['erro'] == 'sss'){ echo "<center>Foto não enviada! O processo deve ser reininciado.</center><p>"; } ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Enviar Vídeo</title> </head> <body> <div align="center"> <form action="upload_file.php" method="post" enctype="multipart/form-data" name="form1" id="form1"> <table width="447" border="0" cellspacing="5"> <tr> <td width="435" colspan="2"><div align="center"><strong>Selecione o vídeo para envio... </strong></div></td> </tr> <tr> <td><div align="left"> <label></label> </div> <div align="center"> <input name="video" type="file" id="video" size="45" /> </div></td> </tr> <tr> <td><div align="center"> <label> <input type="submit" name="Submit" value="OK" /> </label> </div></td> </tr> </table> </form> </div> </body> </html>excluir_video.php<?php include("config.php"); $id_video = $_GET['id']; $nome_video = $_GET['nome']; $nome_foto = $_GET['foto']; if ($id_video != ''){ if (@unlink("videos/$nome_video")) { if (@unlink("fotos/$nome_foto")) { $sql = mysql_query("DELETE FROM videos WHERE videoid = '$id_video'"); header ("location: gerenciar_videos.php?erro=n"); } else { header ("location: gerenciar_videos.php?erro=s"); } } else { header ("location: gerenciar_videos.php?erro=s"); } } else { header ("location: gerenciar_videos.php?erro=s"); } ?>gerenciar_videos.php<?php require_once("config.php"); $sql = mysql_query("SELECT * FROM videos order by videoid DESC", $conn); $dados = mysql_fetch_assoc($sql); $rows = mysql_num_rows($sql); $contador = 0; if ($_GET['erro'] == 's'){ echo "<center>Não foi possível completar sua solicitação!</center><p>"; } if ($_GET['erro'] == 'n'){ echo "<center>Registro excluído com sucesso!</center><p>"; } ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Gerenciar Vídeos</title> <style type="text/css"> <!-- .style1 { color: #FFFFFF; font-weight: bold; } --> </style> </head> <body> <div align="center"> <table width="70%" border="1" cellspacing="2" bordercolor="#000000"> <tr bgcolor="#FF9900"> <td width="288"><div align="center" class="style1">Empresa</div></td> <td width="147"><div align="center" class="style1">Telefone</div></td> <td><div align="center" class="style1">Função</div></td> </tr> <? do { $contador = $contador + 1;?> <tr> <td><div align="center"><? echo $dados['videoempresa']; ?></div></td> <td><div align="center"><? echo $dados['videotel']; ?></div></td> <td width="80"><div align="center"><a href="excluir_video.php?foto=<? echo $dados['videofoto']; ?>&id=<? echo $dados['videoid']; ?>&nome=<? echo $dados['videofile']; ?>"><img src="delete.gif" alt="Excluir" width="16" height="16" border="0"></a></div></td> </tr> <? } while ($dados = mysql_fetch_assoc($sql)); ?> </table> </div> </body> </html> <? mysql_free_result($sql); ?>index.php<?php include("config.php"); $sql = mysql_query("SELECT * FROM videos order by videoid DESC LIMIT 3", $conn); $dados = mysql_fetch_assoc($sql); $rows = mysql_num_rows($sql); $contador = 0; ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Index</title> <style type="text/css"> <!-- body { margin-left: 5px; margin-top: 5px; margin-right: 0px; margin-bottom: 0px; } a:link { color: #000000; } a:visited { color: #000000; } a:hover { color: #000000; } a:active { color: #000000; } --> </style> <script type="text/Javascript"> <!-- function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //--> </script> </head> <body> <table width="50" border="0" cellspacing="5" bordercolor="#000000"> <tr> <? do { $contador = $contador + 1; $nome = $dados["videofile"]; $foto = $dados["videofoto"]; $empresa = $dados["videoempresa"]; $tel = $dados["videotel"]; ?> <td width="87"><div align="center"><img src="fotos/<? echo $foto; ?>" width="60" height="60" border="1" onclick="MM_openBrWindow('ver_video.php?nome=<? echo $nome; ?>','vervideo','width=400,height=335')" /><br> <div align="center"><a href="java script:void( 0);" onclick="window.open('ver_video.php?nome=<? echo $nome; ?>','vervideo','width=400,height=335')"><? echo $empresa ?></a></b></a></a></div></div></td> <? } while ($dados = mysql_fetch_assoc($sql)); ?> </tr> </table> </body> </html>salvar_dados.php<? include("config.php"); $empresa = $_POST['empresa']; $tel = $_POST['telefone']; $arq = $_POST['arquivo']; $pasta = "fotos"."/".$foto_name; if (@copy($foto,$pasta)){ if ($empresa != '' || $tel != '' || $arq != '' || $foto_name != '') { //salva $sql = mysql_query("INSERT INTO videos (videoempresa, videotel, videofile, videofoto) VALUES ('$empresa', '$tel', '$arq', '$foto_name')"); echo "<center>Dados salvos com sucesso!<p><a href=enviar_up.php>Cadastrar Mais</a></center>"; } else { header ("location: enviar_up.php?erro=ss"); } } else { header ("location: enviar_up.php?erro=sss"); } ?>upload_file.php<? //$video = $_FILES['video']['name']; $pasta = "videos"."/".$video_name; if ($_GET['erro'] != 's' or $_GET['erro'] != 'ss') { //move_uploaded_file($_FILES['video']['tmp'], $pasta); if (!@copy($video,$pasta)) echo "<center>O arquivo não pode ser enviado!</center>"; else { echo "<center>Vídeo enviado com sucesso!</center><p>"; } ?> <html> <head> <title>Enviar Vídeo</title> </head> <body> <div align="center"> <form action="salvar_dados.php" method="post" enctype="multipart/form-data" name="form1"> <table width="200" border="0" cellspacing="5"> <tr> <td width="56"><div align="left"><strong>Empresa:</strong></div></td> <td width="128"><div align="left"> <label> <input name="empresa" type="text" id="empresa"> </label> </div></td> </tr> <tr> <td><div align="left"><strong>Telefone:</strong></div></td> <td><div align="left"> <label> <input name="telefone" type="text" id="telefone"> </label> </div></td> </tr> <tr> <td height="26"><div align="left"><strong>Foto:</strong></div></td> <td><div align="left"> <label></label> <input name="foto" type="file" id="foto"> </div></td> </tr> <tr> <td><strong>Arquivo:</strong></td> <td><div align="left"> <label></label> <input name="arquivo" type="text" id="arquivo" value="<? echo $video_name; ?>" readonly=""> </div></td> </tr> <tr> <td colspan="2"><div align="center"> <input type="submit" name="Submit" value="Enviar"> </div></td> </tr> </table> </form> </div> </body> </html> <? } ?>ver_video.php<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Casa Fácil</title> <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } --> </style></head> <body> <div id="player"> <OBJECT id='MediaPlayer1' width="400" height="335" classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1, 52,701' standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'> <param name="fileName" value="videos/<? echo $_GET['nome']; ?>"> <param name="animationatStart" value="false"> <param name="transparentatStart" value="true"> <param name="autoStart" value="true"> <param name="showControls" value="true"> <PARAM NAME="ShowPositionControls" VALUE="true"> <PARAM NAME="ShowAudioControls" VALUE="true"> <PARAM NAME="ShowDisplay" VALUE="false"> <PARAM NAME="EnableTracker" VALUE="true"> <PARAM NAME="ShowTracker" VALUE="true"> <PARAM NAME="ShowStatusBar" VALUE="true"> <param name='loop' value="true"> <EMBED type='application/x-mplayer2' pluginspage='http://microsoft.com/windows/mediaplayer/en/download/' id='MediaPlayer1' displaysize='4' autosize='-1' bgcolor='darkblue' showcontrols="true" showtracker='1' showdisplay='0' showstatusbar='1' videoborder3d='-1' width="400" height="335" src="videos/<? echo $_GET['nome']; ?>" autostart="true" designtimesp='5311' loop="true"> </EMBED> </OBJECT> </div> </body> </html>Estou hospedando em servidor linux para testar, e não é problema no limite de tamanho de arquivo no servidor (no servidor esta 100mb).
Acho que seria melhor usar o "move_upload_file" que esta comentado, mas não consegui fazer isto.
Se alguém souber resolver ou dar alguma opiniao talvez ate de fazer o upload multiplo do video e da imagem em apenas uma pagina ao invés de usar o "enviar_up" para enviar primeiro o video.
Outra questao é que na pagina "index" onde mostra as imagens miniaturas dos videos, não tem quebra de linha, ou seja, se voce cadastrar muitos videos ficarao tudo em uma linha. Talvez poderiamos por ainda uma paginacao.
Se alguém puder ajudar sera de suma importancia.
Link para o comentário
Compartilhar em outros sites
1 resposta a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.