Hi,
I've a php script to deal with uploaded images.
it works fine if i upload a file like file.jpg.
But i got trouble if i try to upload file.JPG. Even if its the same file renamed.
The code:
if(isset($_FILES["arq"])){
@getimagesize($_FILES['arq']['tmp_name']) or $err=5;
($_FILES['arq']['error']==0) or $err=$_FILES['arq']['error'];
if ($err==0){
$dir = "./img/".$_SESSION['estudante']."/";
if (!is_dir($dir)){mkdir($dir);}
$filename = substr(md5(uniqid(rand(), true)),0,20) . ".";
$filename .= pathinfo($_FILES["arq"]["name"], PATHINFO_EXTENSION);
$fotourl = $dir . basename($filename);//$_FILES["arq"]["name"]);
move_uploaded_file($_FILES["arq"]["tmp_name"], $fotourl);
//resize e cira thumbnails
resizeimg($fotourl, 320,204); //editfoto
resizeimg($fotourl, 137,87); //album
resizeimg($fotourl, 200,0); //home
resizeimg($fotourl, 148,0); //perfil
resizeimg($fotourl, 60,60); //thumbnail
resizeimg($fotourl, 100,0); //iframe perfil
resizeimg($fotourl, 530, 530); //slide
resizeimg($fotourl, 330, 0); //i slide
//registra no BD
$sql="INSERT INTO fotos (estudante, url) VALUES ('".$_SESSION['estudante']."', '$fotourl')";
mysql_query($sql);
//retorna o id da foto
$fotoid=mysql_insert_id();
//notifica adms somente
$sql="select estudante from administradores";
$adms=mysql_query($sql);
while ($ar=mysql_fetch_assoc($adms)){
$msg="O usuário <a href=\"perfil.php?id=$_SESSION[estudante]\">".nomeapelido($_SESSION['estudante'])."</a> inseriu uma nova <a href='fotoslide.php?fotoid=$fotoid'>imagem</a>.";
$sql="insert into mensagens (msgde, msgpara, msgmsg) values (5, $ar[estudante], '$msg')"; // 5=cadastro do 'user' sistema
mysql_query($sql);
//echo "$sql\n";
}
mysql_free_result($adms);
}
}