aşağıdaki kodda resim normalde zorunlu olmaması gerekiyor fakat hata veriyor.
Hata da şu; Warning: count(): Parameter must be an array or an object that implements Countable in (27. satırı gösteriyor)
<?php
$_title = 'Müsteri Yorumları';
function uploadFile ($file_field = null, $check_image = false, $random_name = false) {
//Config Section
//Set file upload path
$path = 'upload/comments/'; //with trailing slash
//Set max file size in bytes
$max_size = 100000000;
//Set default file extension whitelist
$whitelist_ext = array('jpeg','jpg','png','gif');
//Set default file type whitelist
$whitelist_type = array('image/jpeg', 'image/jpg', 'image/png','image/gif');
//The Validation
// Create an array to hold any output
$out = array('error'=>null);
if (!$file_field) {
$out['error'][] = "Please specify a valid form field name";
}
if (!$path) {
$out['error'][] = "Please specify a valid upload path";
}
if (count($out['error'])>0) {
return $out;
}
trycatchsoft isimli arkadaşın yöntemi doğrudur, alternatif olarak eğer hata alırsanız 27. satırı şu şekilde değiştirip deneyin:
if ($out['error']!=null) {