Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Mais uma vez eu aqui http://forum.imasters.com.br/public/style_emoticons/default/natal_biggrin.gif
Dessa vez estou com um problema no upload,
a pagina que manda as informações é essa
<?
include ('valida_cookies.php');
require_once ('../conexao.php');
?>
<script>
function Voltar()
{ window.location='index.php'; }
</script>
<html xmlns="[http://www.w3.org/1999/xhtml">](http://www.w3.org/1999/xhtml)
<head>
<script language="JavaScript" src="valida_cad_veic.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Painel de Controle - Procurandocarro.com</title>
<style type="text/css"> background-color: #e8e8e8;
margin-left: 0px;
margin-top: 10px;
margin-right: 0px;
margin-bottom: 0px;
}</style>
<link href="../estilo.css" rel="stylesheet" type="text/css">
<link href="../form.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="middle"><table width="100" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" bgcolor="#FFFFFF"><!-- #BeginLibraryItem "/Library/topo_adm.lbi" --><table width="100" height="100" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="images/topo_admin.jpg" width="752" height="119" border="0" usemap="#sair" /></td>
</tr>
<tr>
<td align="center" valign="middle"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="middle"><a href="veiculos.php"><img src="images/ico_inter_1.gif" width="133" height="67" border="0"></a></td>
<td align="center" valign="middle"><a href="parceiros.php"><img src="images/ico_inter_2.gif" alt="Administrar os parceiros" width="78" height="67" border="0"></a></td>
<td align="center" valign="middle"><a href="noticias.php"><img src="images/ico_inter_3.gif" width="75" height="67" border="0"></a></td>
<td align="center" valign="middle"><a href="ofertas.php"><img src="images/ico_inter_4.gif" width="76" height="67" border="0"></a></td>
<td align="center" valign="middle"><a href="destaque_dia.php"><img src="images/ico_inter_5.gif" width="102" height="67" border="0"></a></td>
<td align="center" valign="middle"><a href="revendedores.php"><img src="images/ico_inter_6.gif" alt="Admin. dos Revendedores" width="89" height="67" border="0"></a></td>
<td align="center" valign="middle"><a href="administradores.php"><img src="images/ico_inter_7.gif" alt="Administradores do site" width="87" height="67" border="0"></a></td>
<td align="center" valign="middle"><a href="outros.php"><img src="images/ico_inter_8.gif" width="53" height="67" border="0"></a></td>
</tr>
<tr>
<td colspan="8" align="center" valign="middle"><img src="../images/spacer.gif" width="1" height="3"></td>
</tr>
</table></td>
</tr>
</table>
<map name="sair">
<area shape="rect" coords="11,8,244,103" href="index.php" name="logo">
<area shape="rect" coords="691,91,740,111" href="../sair.php" alt="Sair do painel de controle" name="sair">
</map><!-- #EndLibraryItem --></td>
</tr>
<tr>
<td height="275" align="center" valign="top" bgcolor="#FFFFFF"><table width="99%" border="0" cellspacing="2" cellpadding="0">
<tr>
<td height="27" align="center" valign="middle" class="titulo_admin">Cadastro de Videos</td>
</tr>
<tr>
<td height="27" align="center" valign="middle" ><form action="videos_inserir.php" method="post" enctype="multipart/form-data" name="form" onSubmit="return checa_formulario(this)">
<table width="495" height="231" border="0">
<tr>
<th width="199" scope="col"> </th>
<th width="286" scope="col"> </th>
</tr>
<tr>
<th scope="row"><div align="right">Data dia/mes/ano</div></th>
<th scope="row"><label>
<input name="dia" type="text" id="dia" size="2" maxlength="2">
<input name="mes" type="text" id="mes" size="2" maxlength="2">
</label>
<label>
<input name="ano" type="text" id="ano" size="4" maxlength="4">
</label></th>
</tr>
<tr>
<th scope="row"><div align="right"></div></th>
<th scope="row"><label></label></th>
</tr>
<tr>
<th scope="row"><div align="right">Cidade</div></th>
<th scope="row"><label>
<select name="cidade" id="cidade">
<option selected>- Selecione -</option>
<option value="Ji-Paraná">Ji-Paraná</option>
<option value="Cacoal">Cacoal</option>
</select>
</label></th>
</tr>
</table>
<p>Video</p>
<p>
<label></label>
</p>
<table width="200" border="0">
<tr>
<th scope="col"><input name="video1" type="file" id="video1" size="50"></th>
</tr>
<tr>
<th scope="col"><div align="left">Revendedora
<select name="revendedor1" class="combo" id="revendedor1">
<?
echo "<option value='0' style='background-color:#e5eef5'>Selecione o Revendedor</option>";
$sql2 = "select tipo, cod_revendedora, revendedora from revendedora order by tipo desc";
$resultado = mysql_query( $sql2 );$tipo = $linha['tipo'];
?>
<option value="<? echo $linha['cod_revendedora']; ?>" <? if($tipo=='revendedor'){echo"style='background-color:#E7EBD3'";}?> ><? echo $linha['revendedora']." "; ?></option>
<?
}
mysql_free_result( $resultado );
?>
</select>
</div></th>
</tr>
<tr>
<th height="108" scope="row"><table width="390" border="0">
<tr>
<th width="384" scope="col">Descrição
<textarea name="descricao1" id="descricao1" cols="45" rows="5"></textarea></th>
</tr>
<tr>
<th scope="row"> </th>
</tr>
</table></th>
</tr>
<tr>
<th scope="col"><input name="video2" type="file" id="video2" size="50"></th>
</tr>
<tr>
<th scope="col"><div align="left">Revendedora
<select name="revendedor2" class="combo" id="revendedor2">
<?
echo "<option value='0' style='background-color:#e5eef5'>Selecione o Revendedor</option>";
$sql2 = "select tipo, cod_revendedora, revendedora from revendedora order by tipo desc";
$resultado = mysql_query( $sql2 );$tipo = $linha['tipo'];
?>
<option value="<? echo $linha['cod_revendedora']; ?>" <? if($tipo=='revendedor'){echo"style='background-color:#E7EBD3'";}?> ><? echo $linha['revendedora']." "; ?></option>
<?
}
mysql_free_result( $resultado );
?>
</select>
</div></th>
</tr>
<tr>
<th scope="row"><table width="390" border="0">
<tr>
<th width="384" scope="col">Descrição
<textarea name="descricao2" id="descricao2" cols="45" rows="5"></textarea></th>
</tr>
<tr>
<th scope="row"> </th>
</tr>
</table></th>
</tr>
<tr>
<th scope="col"><input name="video3" type="file" id="video3" size="50"></th>
</tr>
<tr>
<th scope="col"><div align="left">Revendedora
<select name="revendedor3" class="combo" id="revendedor3">
<?
echo "<option value='0' style='background-color:#e5eef5'>Selecione o Revendedor</option>";
$sql2 = "select tipo, cod_revendedora, revendedora from revendedora order by tipo desc";
$resultado = mysql_query( $sql2 );$tipo = $linha['tipo'];
?>
<option value="<? echo $linha['cod_revendedora']; ?>" <? if($tipo=='revendedor'){echo"style='background-color:#E7EBD3'";}?> ><? echo $linha['revendedora']." "; ?></option>
<?
}
mysql_free_result( $resultado );
?>
</select>
</div></th>
</tr>
<tr>
<th scope="row"><table width="390" border="0">
<tr>
<th width="384" scope="col">Descrição
<textarea name="descricao3" id="descricao3" cols="45" rows="5"></textarea></th>
</tr>
<tr>
<th scope="row"> </th>
</tr>
</table></th>
</tr>
<tr>
<th scope="col"><input name="video4" type="file" id="video4" size="50"></th>
</tr>
<tr>
<th scope="col"><div align="left">Revendedora
<select name="revendedor4" class="combo" id="revendedor4">
<?
echo "<option value='0' style='background-color:#e5eef5'>Selecione o Revendedor</option>";
$sql2 = "select tipo, cod_revendedora, revendedora from revendedora order by tipo desc";
$resultado = mysql_query( $sql2 );$tipo = $linha['tipo'];
?>
<option value="<? echo $linha['cod_revendedora']; ?>" <? if($tipo=='revendedor'){echo"style='background-color:#E7EBD3'";}?> ><? echo $linha['revendedora']." "; ?></option>
<?
}
mysql_free_result( $resultado );
?>
</select>
</div></th>
</tr>
<tr>
<th scope="row"><table width="390" border="0">
<tr>
<th width="384" scope="col">Descrição
<textarea name="descricao4" id="descricao4" cols="45" rows="5"></textarea></th>
</tr>
<tr>
<th scope="row"> </th>
</tr>
</table></th>
</tr>
<tr>
<th scope="col"><input name="video5" type="file" id="video5" size="50"></th>
</tr>
<tr>
<th scope="col"><div align="left">Revendedora
<select name="revendedor5" class="combo" id="revendedor5">
<?
echo "<option value='0' style='background-color:#e5eef5'>Selecione o Revendedor</option>";
$sql2 = "select tipo, cod_revendedora, revendedora from revendedora order by tipo desc";
$resultado = mysql_query( $sql2 );$tipo = $linha['tipo'];
?>
<option value="<? echo $linha['cod_revendedora']; ?>" <? if($tipo=='revendedor'){echo"style='background-color:#E7EBD3'";}?> ><? echo $linha['revendedora']." "; ?></option>
<?
}
mysql_free_result( $resultado );
?>
</select>
</div></th>
</tr>
<tr>
<th scope="row"><table width="390" border="0">
<tr>
<th width="384" scope="col">Descrição
<textarea name="descricao5" id="descricao5" cols="45" rows="5"></textarea></th>
</tr>
<tr>
<th scope="row"> </th>
</tr>
</table></th>
</tr>
<tr>
<th scope="col"><input name="video6" type="file" id="video6" size="50"></th>
</tr>
<tr>
<th scope="col"><div align="left">Revendedora
<select name="revendedor6" class="combo" id="revendedor6">
<?
echo "<option value='0' style='background-color:#e5eef5'>Selecione o Revendedor</option>";
$sql2 = "select tipo, cod_revendedora, revendedora from revendedora order by tipo desc";
$resultado = mysql_query( $sql2 );$tipo = $linha['tipo'];
?>
<option value="<? echo $linha['cod_revendedora']; ?>" <? if($tipo=='revendedor'){echo"style='background-color:#E7EBD3'";}?> ><? echo $linha['revendedora']." "; ?></option>
<?
}
mysql_free_result( $resultado );
?>
</select>
</div></th>
</tr>
<tr>
<th scope="row"><table width="390" border="0">
<tr>
<th width="384" scope="col">Descrição
<textarea name="descricao6" id="descricao6" cols="45" rows="5"></textarea></th>
</tr>
<tr>
<th scope="row"> </th>
</tr>
</table></th>
</tr>
<tr>
<th scope="col"><input name="video7" type="file" id="video7" size="50"></th>
</tr>
<tr>
<th scope="col"><div align="left">Revendedora
<select name="revendedor7" class="combo" id="revendedor7">
<?
echo "<option value='0' style='background-color:#e5eef5'>Selecione o Revendedor</option>";
$sql2 = "select tipo, cod_revendedora, revendedora from revendedora order by tipo desc";
$resultado = mysql_query( $sql2 );$tipo = $linha['tipo'];
?>
<option value="<? echo $linha['cod_revendedora']; ?>" <? if($tipo=='revendedor'){echo"style='background-color:#E7EBD3'";}?> ><? echo $linha['revendedora']." "; ?></option>
<?
}
mysql_free_result( $resultado );
?>
</select>
</div></th>
</tr>
<tr>
<th scope="row"><table width="390" border="0">
<tr>
<th width="384" scope="col">Descrição
<textarea name="descricao7" id="descricao7" cols="45" rows="5"></textarea></th>
</tr>
<tr>
<th scope="row"> </th>
</tr>
</table></th>
</tr>
<tr>
<th scope="col"><input name="video8" type="file" id="video8" size="50"></th>
</tr>
<tr>
<th scope="col"><div align="left">Revendedora
<select name="revendedor8" class="combo" id="revendedor8">
<?
echo "<option value='0' style='background-color:#e5eef5'>Selecione o Revendedor</option>";
$sql2 = "select tipo, cod_revendedora, revendedora from revendedora order by tipo desc";
$resultado = mysql_query( $sql2 );$tipo = $linha['tipo'];
?>
<option value="<? echo $linha['cod_revendedora']; ?>" <? if($tipo=='revendedor'){echo"style='background-color:#E7EBD3'";}?> ><? echo $linha['revendedora']." "; ?></option>
<?
}
mysql_free_result( $resultado );
?>
</select>
</div></th>
</tr>
<tr>
<th scope="row"><table width="390" border="0">
<tr>
<th width="384" scope="col">Descrição
<textarea name="descricao8" id="descricao8" cols="45" rows="5"></textarea></th>
</tr>
<tr>
<th scope="row"> </th>
</tr>
</table></th>
</tr>
<tr>
<th scope="col"><input name="video9" type="file" id="video9" size="50"></th>
</tr>
<tr>
<th scope="col"><div align="left">Revendedora
<select name="revendedor9" class="combo" id="revendedor9">
<?
echo "<option value='0' style='background-color:#e5eef5'>Selecione o Revendedor</option>";
$sql2 = "select tipo, cod_revendedora, revendedora from revendedora order by tipo desc";
$resultado = mysql_query( $sql2 );$tipo = $linha['tipo'];
?>
<option value="<? echo $linha['cod_revendedora']; ?>" <? if($tipo=='revendedor'){echo"style='background-color:#E7EBD3'";}?> ><? echo $linha['revendedora']." "; ?></option>
<?
}
mysql_free_result( $resultado );
?>
</select>
</div></th>
</tr>
<tr>
<th scope="row"><table width="390" border="0">
<tr>
<th width="384" scope="col">Descrição
<textarea name="descricao9" id="descricao9" cols="45" rows="5"></textarea></th>
</tr>
<tr>
<th scope="row"> </th>
</tr>
</table></th>
</tr>
<tr>
<th scope="col"><input name="video10" type="file" id="video10" size="50"></th>
</tr>
<tr>
<th scope="col"><div align="left">Revendedora
<select name="revendedor10" class="combo" id="revendedor10">
<?
echo "<option value='0' style='background-color:#e5eef5'>Selecione o Revendedor</option>";
$sql2 = "select tipo, cod_revendedora, revendedora from revendedora order by tipo desc";
$resultado = mysql_query( $sql2 );$tipo = $linha['tipo'];
?>
<option value="<? echo $linha['cod_revendedora']; ?>" <? if($tipo=='revendedor'){echo"style='background-color:#E7EBD3'";}?> ><? echo $linha['revendedora']." "; ?></option>
<?
}
mysql_free_result( $resultado );
?>
</select>
</div></th>
</tr>
<tr>
<th scope="row"><table width="390" border="0">
<tr>
<th width="384" scope="col">Descrição
<textarea name="descricao10" id="descricao10" cols="45" rows="5"></textarea></th>
</tr>
<tr>
<th scope="row"> </th>
</tr>
</table></th>
</tr>
<tr>
<th scope="col"><input name="video11" type="file" id="video11" size="50"></th>
</tr>
<tr>
<th scope="col"><div align="left">Revendedora
<select name="revendedor11" class="combo" id="revendedor11">
<?
echo "<option value='0' style='background-color:#e5eef5'>Selecione o Revendedor</option>";
$sql2 = "select tipo, cod_revendedora, revendedora from revendedora order by tipo desc";
$resultado = mysql_query( $sql2 );$tipo = $linha['tipo'];
?>
<option value="<? echo $linha['cod_revendedora']; ?>" <? if($tipo=='revendedor'){echo"style='background-color:#E7EBD3'";}?> ><? echo $linha['revendedora']." "; ?></option>
<?
}
mysql_free_result( $resultado );
?>
</select>
</div></th>
</tr>
<tr>
<th scope="row"><table width="390" border="0">
<tr>
<th width="384" scope="col">Descrição
<textarea name="descricao11" id="descricao11" cols="45" rows="5"></textarea></th>
</tr>
<tr>
<th scope="row"> </th>
</tr>
</table></th>
</tr>
<tr>
<th scope="col"><input name="video12" type="file" id="video12" size="50"></th>
</tr>
<tr>
<th scope="col"><div align="left">Revendedora
<select name="revendedor12" class="combo" id="revendedor12">
<?
echo "<option value='0' style='background-color:#e5eef5'>Selecione o Revendedor</option>";
$sql2 = "select tipo, cod_revendedora, revendedora from revendedora order by tipo desc";
$resultado = mysql_query( $sql2 );$tipo = $linha['tipo'];
?>
<option value="<? echo $linha['cod_revendedora']; ?>" <? if($tipo=='revendedor'){echo"style='background-color:#E7EBD3'";}?> ><? echo $linha['revendedora']." "; ?></option>
<?
}
mysql_free_result( $resultado );
?>
</select>
</div></th>
</tr>
<tr>
<th scope="row"><table width="390" border="0">
<tr>
<th width="384" scope="col">Descrição
<textarea name="descricao12" id="descricao12" cols="45" rows="5"></textarea></th>
</tr>
<tr>
<th scope="row"> </th>
</tr>
</table></th>
</tr>
<tr>
<th scope="col"><input name="video13" type="file" id="video13" size="50"></th>
</tr>
<tr>
<th scope="col"><div align="left">Revendedora
<select name="revendedor13" class="combo" id="revendedor13">
<?
echo "<option value='0' style='background-color:#e5eef5'>Selecione o Revendedor</option>";
$sql2 = "select tipo, cod_revendedora, revendedora from revendedora order by tipo desc";
$resultado = mysql_query( $sql2 );$tipo = $linha['tipo'];
?>
<option value="<? echo $linha['cod_revendedora']; ?>" <? if($tipo=='revendedor'){echo"style='background-color:#E7EBD3'";}?> ><? echo $linha['revendedora']." "; ?></option>
<?
}
mysql_free_result( $resultado );
?>
</select>
</div></th>
</tr>
<tr>
<th scope="row"><table width="390" border="0">
<tr>
<th width="384" scope="col">Descrição
<textarea name="descricao13" id="descricao13" cols="45" rows="5"></textarea></th>
</tr>
<tr>
<th scope="row"> </th>
</tr>
</table></th>
</tr>
<tr>
<th scope="col"><input name="video14" type="file" id="video14" size="50"></th>
</tr>
<tr>
<th scope="col"><div align="left">Revendedora
<select name="revendedor14" class="combo" id="revendedor14">
<?
echo "<option value='0' style='background-color:#e5eef5'>Selecione o Revendedor</option>";
$sql2 = "select tipo, cod_revendedora, revendedora from revendedora order by tipo desc";
$resultado = mysql_query( $sql2 );$tipo = $linha['tipo'];
?>
<option value="<? echo $linha['cod_revendedora']; ?>" selected <? if($tipo=='revendedor'){echo"style='background-color:#E7EBD3'";}?> ><? echo $linha['revendedora']." "; ?></option>
<?
}
mysql_free_result( $resultado );
?>
</select>
</div></th>
</tr>
<tr>
<th scope="row"><table width="390" border="0">
<tr>
<th width="384" scope="col">Descrição
<textarea name="descricao14" id="descricao14" cols="45" rows="5"></textarea></th>
</tr>
<tr>
<th scope="row"> </th>
</tr>
</table></th>
</tr>
</table>
<p> </p>
<input name="voltar" type="button" class="ButtonAzul" id="voltar" value="Voltar" style="width: 120px" onClick="Voltar()"/>
<input name="limpar" type="reset" class="Button" id="limpar" value="Limpar dados" style="width: 120px" />
<input name="cadastrar" type="submit" class="Button" id="cadastrar" value="Cadastrar Video" style="width: 120px" />
</form> </td>
</tr>
</table></td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><!-- #BeginLibraryItem "/Library/rodape_admin.lbi" --><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/rodape_admin.jpg" width="752" height="43" border="0" usemap="#netmidia" /></td>
</tr>
</table>
<map name="netmidia">
<area shape="rect" coords="651,3,746,36" href="[http://www.net-midia.com"](http://www.net-midia.com) target="_blank" alt="Desenvolvimento de Websites">
</map><!-- #EndLibraryItem --></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html><?
include ('valida_cookies.php');
include ('funcoes.php');
//$upload = new Upload();
//$upload->Envia_Arquivo();
//recebe variáveis
$revendedora = $_POST['revendedor1'];
$cidade = $_POST['cidade'];
$dia = $_POST['dia'];
$mes = $_POST['mes'];
$ano = $_POST['ano'];
$datae = "$ano-$mes-$dia";
$descricao = $_POST['descricao1'];
$video = $_FILES['video1'];
$pasta_dir = "../videos/";
//-------------------------------------------------------------------------
// Se nao existir a pasta ele cria uma
if(!file_exists($pasta_dir)){
mkdir($pasta_dir);
}
$nome_video = md5(uniqid(time()));
$nome_video = "$nome_video.wmv";
move_uploaded_file($video['tmp_name'], "$pasta_dir/$nome_video");
// Aqui salva no banco as informações do veículo
mysql_query ("INSERT INTO videos(revendedora,descricao,data,cidade,video)
VALUES ('$revendedora','$descricao','$datae','$cidade','$nome_video')");
$sucesso=1;
?>e pra fazer os varios cadastros acho q tereiq usar o for, mas so horrivel, isso aqui seria o correto?
<?
include ('valida_cookies.php');
include ('funcoes.php');
//$upload = new Upload();
//$upload->Envia_Arquivo();
for($i = 1;$i < 16; $i++) {
if(file_exists($_FILES['video'.$i])) {$revendedora = $_POST['revendedor'.$i];
$cidade = $_POST['cidade'];
$dia = $_POST['dia'];
$mes = $_POST['mes'];
$ano = $_POST['ano'];
$datae = "$ano-$mes-$dia";
$descricao = $_POST['descricao'.$i];
$video = $_FILES['video'.$i];
$pasta_dir = "../videos/";
//-------------------------------------------------------------------------
// Se nao existir a pasta ele cria uma
if(!file_exists($pasta_dir)){
mkdir($pasta_dir);
}
$nome_video = md5(uniqid(time()));
$nome_video = "$nome_video.wmv";
move_uploaded_file($video['tmp_name'], "$pasta_dir/$nome_video");
// Aqui salva no banco as informações do veículo
mysql_query ("INSERT INTO videos(revendedora,descricao,data,cidade,video)
VALUES ('$revendedora','$descricao','$datae','$cidade','$nome_video')");
$sucesso=1;
}
}
?>Carregando comentários...