"Nao foi possivel renomear o arquivo."
me ajudem plix, n sei oque ta errado =-((
<?php
}
function CheckAction(){
if (empty($_POST['submit'])) {
$this->FormFile();
}else{
$this->Archive = $_FILES['foto'];
$this->UpLoadFile();
}
}
function UpLoadFile(){
$NomeDoArquivo = $this->Archive['name'];
$ArquivoTemporario = $this->Archive['tmp_name'];
$Tipo = $this->Archive['type'];
if(ereg("(image)", $Tipo)){
move_uploaded_file($ArquivoTemporario, $this->Diretorio.$NomeDoArquivo);
$this->RenameFile();
}else{
$this->Erro['AI'] .= 'Arquivo inválido!';
$this->Erro['AI'] .= '<strong> ['.$this->Archive['type'].']</strong><br />';
$this->Erro['AI'] .= 'Este sistema aceita apenas arquivos com MIME contendo \'image\'';
}
}
function RenameFile(){
$NovoNome = md5(mktime());
$NomeDoArquivo = $this->Archive['name'];
$Separa = explode('.', $NomeDoArquivo);
$NewName = $NovoNome.'.'.$Separa[1];
$FileSize = round($this->Archive['size']/1024, 1);
$Renomeia = rename($this->Diretorio.$NomeDoArquivo, $this->Diretorio.$NewName);
if($Renomeia){
$fotoo = $_POST['fotoo'];
@$insere = mysql_query("INSERT INTO fotos (nome, url) VALUES ('$fotoo','$NewName')");
if($insere){
?>
</font>
<p><font color="#000000" size="2" face="verdana">O arquivo <strong><em><?PHP echo''.$NomeDoArquivo.''; ?></em></strong>
foi enviado e cadastrado com sucesso!</font></p>
<p><font color="#000000" size="2" face="verdana"><strong><em>Informações:</em></strong>
<strong>Novo nome-</strong> <?PHP echo''.$NewName.''; ?> <strong>Tamanho- </strong><?PHP echo''.$FileSize.' kb'; ?></font></p>
<font color="#000000">
<?
}
}else{
$this->Erro[] = 'Erro ao renomear Arquivo!';
}
}
function ShowErrors(){
foreach($this->Erro as $Erro){
echo '<strong>Houve um erro:</strong> '.$Erro;
}
}
}
$CallClass = new UpLoadAndChangeTheName;
$CallClass->CheckAction();
$CallClass->ShowErrors();
?>---
tive q apelar =-( toquei de codigo ... mais deu certu flw!
Edição feita por: MarcoviZ, 09/07/2006, 02:49.










