bunu atılan resimler sabit bir orantıda veremedim
yardımcı olursanız sevinirim..
class.php de yer alan bu kod ile yüklüyor
public static function fileUpload($location,$ext,$name,$target){
$return = null;
$avaible = null;
$exists = strtolower(substr($ext, strrpos($ext, ".")));
$avaible = array(".jpg", ".jpeg", ".png", ".bmp", ".gif", ".pdf", ".docx", ".doc");
if(in_array($exists, $avaible)){
$new_name = $name.$exists;
$to_location = $target.'/'.$new_name;
if (move_uploaded_file($location, $to_location)){ $return = $new_name; }
}else{ $return = null; }
return DB::control($return,'text');
}
public static function reArrayFiles($file_post) {
$file_ary = array();
$file_count = count($file_post['name']);
$file_keys = array_keys($file_post);
for ($i=0; $i<$file_count; $i ) {
foreach ($file_keys as $key) {
$file_ary[$i][$key] = $file_post[$key][$i];
}
}
return $file_ary;
}buda resmin eklendigi yer php dosyasındaki yer if (isset($_FILES['photo'])) {
$i = 1;
$file_array = DB::reArrayFiles($_FILES['photo']);
foreach ($file_array as $file) {
$photo = DB::fileUpload($file['tmp_name'], $file['name'], DB::seo($_POST['title'].'-'.$i), '../../uploads/projects');
DB::insert("INSERT INTO projects_photos(p_id, photo) VALUES($result, $photo)");
$i++;
}
}