tek hatırladığım, $uploadfile = $dosyaadi; burada bir sorun olduğudur..
$dosya_adi = $_FILES['resim']['name'];
$array = explode(".","$dosya_adi");
$uzanti=$array[1];
$uploaddir = 'resim/';
$dosyaadi=md5(str_replace(".","",date("dmY").str_replace(" ","",microtime()))).".$uzanti";
$uploadfile = $uploaddir;
if (!move_uploaded_file($_FILES['resim']['tmp_name'], $uploadfile)) {
die('Dosya upload yapılırken Hata Oluştu: ' . mysql_error());
};
$uploadfile = $dosyaadi;

