Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Amigos
Eu uso um codigo p/ inserir fotos, funciona bem, mas agora esta dando esse erro q nunca vi.
Warning: mkdir() [function.mkdir]: SAFE MODE Restriction in effect. The script whose uid is 34430 is not allowed to access /home/pcitamam/public_html/fotos/10 owned by uid 99 in /home/pcitamam/public_html/adm/insert_fotos.php on line 85
Warning: mkdir() [function.mkdir]: SAFE MODE Restriction in effect. The script whose uid is 34430 is not allowed to access /home/pcitamam/public_html/fotos/10 owned by uid 99 in /home/pcitamam/public_html/adm/insert_fotos.php on line 88
Warning: mkdir() [function.mkdir]: SAFE MODE Restriction in effect. The script whose uid is 34430 is not allowed to access /home/pcitamam/public_html/fotos/10 owned by uid 99 in /home/pcitamam/public_html/adm/insert_fotos.php on line 92
Warning: move_uploaded_file() [function.move-uploaded-file]: SAFE MODE Restriction in effect. The script whose uid is 34430 is not allowed to access /home/pcitamam/public_html/fotos/10 owned by uid 99 in /home/pcitamam/public_html/adm/insert_fotos.php on line 101
Warning: mkdir() [function.mkdir]: SAFE MODE Restriction in effect. The script whose uid is 34430 is not allowed to access /home/pcitamam/public_html/fotos/10 owned by uid 99 in /home/pcitamam/public_html/adm/insert_fotos.php on line 85
Warning: mkdir() [function.mkdir]: SAFE MODE Restriction in effect. The script whose uid is 34430 is not allowed to access /home/pcitamam/public_html/fotos/10 owned by uid 99 in /home/pcitamam/public_html/adm/insert_fotos.php on line 88
Warning: mkdir() [function.mkdir]: SAFE MODE Restriction in effect. The script whose uid is 34430 is not allowed to access /home/pcitamam/public_html/fotos/10 owned by uid 99 in /home/pcitamam/public_html/adm/insert_fotos.php on line 92
Warning: move_uploaded_file() [function.move-uploaded-file]: SAFE MODE Restriction in effect. The script whose uid is 34430 is not allowed to access /home/pcitamam/public_html/fotos/10 owned by uid 99 in /home/pcitamam/public_html/adm/insert_fotos.php on line 101
Nao tenho problemas em outros sites e o code esta identico. Vejam ele e se puderem me ajudar agradeço.
<style type="text/css">
body{
margin: 50px 20px 0px 20px;
font-family: Arial, Helvetica, sans-serif;
padding: 5px;
font-size: 11px;
color: #333333;
} font-size: 20px;
font-weight: bold;
text-align: left;
} color:#006699;
text-decoration: none;
} color: #993300;
text-decoration: none;
}
</style>
<?php
//anti_injection include "int/protege.php";$imagens = $_FILES['arquivo'];
$status = $_POST['status'];
$codigo = $_POST['codigo'];
$legenda = $_POST['legenda'];
$total = $_POST['total'];
echo"<h1>$codigo</h1>"; for($g=0; $g<$total; $g++)
if($nome = $_FILES['arquivo']['name'][$g] != ""){ // para campos vazios
{
$nome = $_FILES['arquivo']['name'][$g];
$tipo = $_FILES['arquivo']['type'][$g];
$tmpname = $_FILES['arquivo']['tmp_name'][$g];
//-----------------------------------checa imagem------------------------------//
// Tamanho máximo do arquivo em bytes
$maximo = 800000;
//Verificação
if($tamanho > $maximo)
{
echo "<h1> Arquivo maior que o limite máximo de " . $maximo . " bytes!</h1>";
echo "<img src=\"img/carregando.gif\" alt=\"carregando\"/>";
echo "<META HTTP-EQUIV=REFRESH CONTENT='3; URL=cadastrar_fotos_qtd.php'>";
exit;
}
// Verifica se o arquivo enviado é uma
if(!preg_match('/^image\/(gif|jpeg|jpg|png)$/', $tipo))
{
echo"<h1>Envie uma imagem em formato válido, gif, jpeg, jpg ou png</h1>";
echo "<img src=\"img/carregando.gif\" alt=\"carregando\"/>";
echo "<META HTTP-EQUIV=REFRESH CONTENT='3; URL=cadastrar_fotos_qtd.php'>";
exit;
}$renomear = md5(uniqid(rand(), true)); // nome aleatorio
$nome_grande = ("grande-" . $renomear . ".jpg"); // cria nome da imagem grande
$nome_medio = ("medio-" . $renomear . ".jpg"); // cria nome da imagem media
$nome_thumb = ("mini-" . $renomear . ".jpg"); // cria nome da imagem pequena
$matriz[] = $nome_grande;
$matriz_medio[] = $nome_medio;
$matriz_thumb[] = $nome_thumb;
//criando o diretorio para a foto
$dir = "../fotos/$codigo/";
//diretorio pra onde vai a imagem grande
$pasta_imagens_G = "../fotos/$codigo/g/";
//diretorio pra onde vai a imagem pequena
$pasta_imagens_M = "../fotos/$codigo/m/";
//diretorio pra onde vai a imagem pequena
$pasta_imagens_P = "../fotos/$codigo/p/";
//cria os diretorios
if(!file_exists($dir)) {
mkdir($dir);
}
if(!file_exists($pasta_imagens_G)) {
mkdir($pasta_imagens_G);
}
if(!file_exists($pasta_imagens_M)) {
mkdir($pasta_imagens_M);
}
if(!file_exists($pasta_imagens_P)) {
mkdir($pasta_imagens_P);
}
$caminho_G = $pasta_imagens_G . $nome; // caminho com nome da img grande e local para guardar
$caminho_M = $pasta_imagens_M . $nome; // caminho com nome da img media e local para guardar
$caminho_P = $pasta_imagens_P . $nome; // caminho com nome da img pequena e local para guardar
//--------- CRIAR IMAGEM PROPORCIONAL -------------------------------------------
if(move_uploaded_file($tmpname, $caminho_G)) // move a tmp_name pro caminho dado
{
list($pontoX, $pontoY, $tipo) = getimagesize($caminho_G);
$img = imagecreatefromjpeg($caminho_G);
$largura_maxima = 500; //largura máxima
$altura_maxima = 380; //altura máxima
// se a altura e largura originais forem iguais
if ($pontoX == $pontoY) {
$largura = $largura_maxima;
$altura = $largura_maxima;
}
// se a largura for maior que a altura
elseif ($pontoX >= $pontoY) {
$nova_largura = $largura_maxima;
$nova_altura = ($pontoY*$nova_largura)/$pontoX;
// mas se depois da redução a altura for maior que $altura_maxima então reduz novamente
if ($nova_altura >= $altura_maxima) {
$altura = $altura_maxima;
$largura = ($nova_largura*$altura)/$nova_altura;
}
else {
$largura = $largura_maxima;
$altura = ($pontoY*$largura)/$pontoX;
}
}
elseif ($pontoX <= $pontoY) { // se a largura for menor que a altura
$nova_altura = $altura_maxima;
$nova_largura = ($pontoX*$nova_altura)/$pontoY;
// mas se depois da redução a largura for maior que a $largura_maxima então reduz novamente
if ($nova_largura >= $largura_maxima) {
$largura = $largura_maxima;
$altura = ($nova_altura*$largura)/$nova_largura;
}
else {
$altura = $altura_maxima;
$largura = ($pontoX*$altura)/$pontoY;
}
}
// aqui eu pego a imagem no caminho e jogo na memoria
$foto_grande = imagecreatetruecolor($largura, $altura);
imagecopyresampled($foto_grande, $img, 0, 0, 0, 0, $largura, $altura, $pontoX, $pontoY); // sample da imagem com o tamanho
imagejpeg($foto_grande, $pasta_imagens_G . $nome_grande, 80);
//-------------------------- CRIAR THUMB--------------------------//
//criando a foto media
// aqui eu pego a imagem no caminho e jogo na memoria
$medio = imagecreatetruecolor(200, 150);
// sample da imagem com o tamanho
imagecopyresampled($medio, $img, 0, 0, 0, 0, 200, 150, $pontoX, $pontoY);
imagejpeg($medio, $pasta_imagens_M . $nome_medio, 90);
//criando a foto mini
//aqui eu pego a imagem no caminho e jogo na memoria
$thumbnail = imagecreatetruecolor(70, 50);
// sample da imagem com o tamanho
imagecopyresampled($thumbnail, $img, 0, 0, 0, 0, 70, 50, $pontoX, $pontoY);
imagejpeg($thumbnail, $pasta_imagens_P . $nome_thumb, 90);
unlink($caminho_G); // apaga a imagem original//--------------------------Grava no banco--------------------------//
$imagens = $_FILES['arquivo'];
$status = $_POST['status'];
$codigo = $_POST['codigo'];
$legenda = $_POST['legenda'];
$total = $_POST['total'];
// -Banco de Dados - //
include "int/liga.php";
$total = $_POST['total'];
for($i=0; $i < $total; $i++)
{//for
//gravando no bd
$res = mysql_query("insert into fotos (status, codigo, foto_g, foto_m, foto_p, legenda)
values (
'".$status."',
'".$codigo."',
'".$matriz[$i]. "',
'".$matriz_medio[$i]. "',
'".$matriz_thumb[$i]. "',
'".$legenda[$i]."'
)"
);
if($res)
{
echo "Upload do arquivo $legenda[$i] foi um sucesso!<br>";
}
else
{
echo "Upload do arquivo $legenda[$i] não foi concluido! Tente novamente";
echo "<img src=\"img/carregando.gif\" alt=\"carregando\"/>";
echo "<META HTTP-EQUIV=REFRESH CONTENT='3; URL=cadastrar_fotos_qtd.php'>";
exit;
}
}//fim do for
echo "<a href=\"cadastrar_foto_qtd.php\"><h1>Enviar mais fotos?</h1></a>";
echo "<a href=\"imoveis.php\"><h1>Não quero enviar mais fotos.</h1></a>";
?>Carregando comentários...