Jquery Çoklu fotoğraf yükleme hakkında
Bu şekilde nası kayıt eder ve veriyi nası çekerim
php ornegını yaptım gerısı sende
https://www.verot.net/php_class_upload_download.htm
gereklı dosyayı dahıl et
<?php
namespace Verot\Upload;
include('src/class.upload.php');
?>
<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<form action="" method="POST" enctype="multipart/form-data">
<p>Resimler:
<input type="file" name="gorsel[]" multiple />
<input type="submit" name="resimkayit" value="Gönder" />
</p>
</form>
<?php
if((isset($_FILES['gorsel']))){
$dosya_yolu = "img/";
$files = array();
foreach ($_FILES['gorsel'] as $k => $l) {
foreach ($l as $i => $v) {
if (!array_key_exists($i, $files))
$files[$i] = array();
$files[$i][$k] = $v;
}
}
foreach ($files as $file) {
$handle = new Upload($file);
if ($handle->uploaded) {
// kucuk
$sifrele = rand(1234567,7654321);
$handle->file_new_name_body = $sifrele;
$handle->file_auto_rename = true;
$handle->image_resize = true;
$handle->image_x = 900;
$handle->image_ratio_y = true;
$handle->mime_check = true;
$handle->image_convert = 'jpg';
$handle->jpg_quality = 100;
$handle->Process($dosya_yolu);
$buyuk = $handle->file_dst_name; // BUYUK HALI
$handle->file_new_name_body = $sifrele;
$handle->file_auto_rename = true;
$handle->image_resize = true;
$handle->image_ratio_crop = 'C';
$handle->image_x = 380;
$handle->image_y = 210;
$handle->mime_check = true;
$handle->image_convert = 'jpg';
$handle->jpg_quality = 75;
$handle->Process($dosya_yolu);
$kucuk = $handle->file_dst_name; //KUCUK HALI
} else {
//hata kodu
}
if ($handle->processed) {
$kayit =$db->prepare("INSERT INTO foto_tablon(resim) VALUES(?)");
$kayit->execute([$buyuk]);
echo '<img src="img/'.$buyuk.'">';
} else {
echo $handle->error ;
}
}
}
?>
</body>
</html>