<?php<?php
$baglan="localhost";$dbname="resim";$kullanici="root";$parola="";try{$db=newPDO("mysql:host=$baglan;dbname=$dbname;charset=utf8",$kullanici,$parola);}catch(PDOException $e){echo$e->getMessage();}?><formaction=""method="POST"enctype="multipart/form-data"><p>Resimler:
<inputtype="file"name="gorsel[]"/><inputtype="file"name="gorsel[]"/><inputtype="file"name="gorsel[]"/><inputtype="submit"name="resimkayit"value="Gönder"/></p></form><?phpif(isset($_POST['resimkayit'])){foreach($_FILES["gorsel"]["error"]as$anahtar=>$hata){if($hata==UPLOAD_ERR_OK){$uploads_dir='data';
@$tmp_name=$_FILES['gorsel']["tmp_name"][$anahtar];$benzersizsayi4=rand(20000,32000);$uzanti='.jpg';$resimyol=substr($uploads_dir)."/".$benzersizsayi4.$uzanti.[$anahtar];
@move_uploaded_file($tmp_name,"$uploads_dir/$benzersizsayi4$uzanti");}}$kaydet=$db->prepare("INSERT INTO resim SET
gorsel=:gorsel");$insert=$kaydet->execute(array('gorsel'=>$resimyol));if($insert){header("Location:index.php?durum=ok");}else{header("Location:index.php?durum=no");}}?>