Verot.net Upload
if(isset($_POST['ogrenciekle']))
{
$image = new Upload( $_FILES[ 'image' ] );
if ( $image->uploaded ) {
$image->file_new_name_body = substr(base64_encode(uniqid(true)), 0, 30);
// resmi jpg Zorunluluğu
$image->allowed = array ( 'image/*' );
// resmi jpg formatına convert edelim
$image->image_convert = 'jpg';
// jpg resimlerin kalitesini ayarlamak için kullanılır
$image->jpeg_quality = 50;
// upload klasörüne değişiklik yapmadan kayıt et
$image->Process( 'upload/' );
// maksimum yüklenecek dosya boyutu belirlenir. 1024 = 1KB
$image->file_max_size = '2097152';
$imagebuyuk = $image->file_dst_name;
}
$query = $db->prepare("INSERT INTO ogrenciler SET
ogrenci_resimyol = :resimyol,
ogrenci_ad = :ad,
ogrenci_soyad = :soyad,
ogrenci_numara = :numara,
ogrenci_sinif = :sinif");
$insert = $query->execute(array(
"resimyol" => $imagebuyuk,
"ad" => $_POST['ogrenci_ad'],
"soyad" => $_POST['ogrenci_soyad'],
"numara" => $_POST['ogrenci_numara'],
"sinif" => $_POST['ogrenci_sinif'],
));
if ( $insert ){
print "insert işlemi başarılı!";
header('Location: index.php?durum=yes');
}else{
header('Location: index.php?durum=no');
}
}
insert işlemim sorunsuz çalısıyor fakat upload işlemimde
şöyle bir kod dizini kullandım
if(isset($_POST['ogrenciduzenle'])){
$image = new Upload( $_FILES[ 'image' ] );
if ( $image->uploaded ) {
$image->file_new_name_body = substr(base64_encode(uniqid(true)), 0, 30);
// resmi jpg Zorunluluğu
$image->allowed = array ( 'image/*' );
// resmi jpg formatına convert edelim
$image->image_convert = 'jpg';
// jpg resimlerin kalitesini ayarlamak için kullanılır
$image->jpeg_quality = 50;
// upload klasörüne değişiklik yapmadan kayıt et
$image->Process( 'upload/' );
// maksimum yüklenecek dosya boyutu belirlenir. 1024 = 1KB
$image->file_max_size = '2097152';
$imagebuyuk = $image->file_dst_name;
}
$ogrenci_id = $_POST['ogrenci_id'];
$guncelle = $db->prepare("UPDATE ogrenciler SET
ogrenci_resimyol = :resimyol,
ogrenci_ad = :ad,
ogrenci_soyad = :soyad,
ogrenci_numara = :numara,
ogrenci_sinif = :sinif WHERE ogrenci_id=:id");
$duzenle = $guncelle->execute(array(
"resimyol" => $imagebuyuk,
"ad" => $_POST['ogrenci_ad'],
"soyad" => $_POST['ogrenci_soyad'],
"numara" => $_POST['ogrenci_numara'],
"sinif" => $_POST['ogrenci_sinif'],
"id" => $ogrenci_id
));
if($duzenle){
header('Location: index.php?durum=yes');
}else{
header('Location: ogrenciduzenle.php?durum=no');
}
}
Fotoğrafı upload edemi,yorum
Soru hatalı mı? 👎
Eğer sorunun kurallara aykırı olduğunu düşünüyorsanız lütfen bize bildirin!
Cevaplar (0)
Henüz kimse cevap yazmadı. İlk cevap yazan sen ol!