I have three files:
1. moodsLogo.jpg
2. Copy of (images').jpg
3. Moods logo (Custom).jpg
ve ben aşağıdaki kodu var:
// (..) some code here
$fileName = valid_filename($_FILES[ 'Filedata' ][ 'name' ]);
$bl->updateFieldValue("tableName","columnName",$fileName, $id);
function valid_filename($filename)
{
$filename = str_replace(" ", "_", $filename);
$pattern = "/[^[a-z0-9._-]/";
return preg_replace($pattern, "", strtolower($filename));
}
Ve SQL bu gibi görünüyor:
public function updateFieldValue($table,$column,$value, $id)
{
$result = parent::updateRow($table,$column, $value, $id);
return $result;
}
public function updateRow($table,$column, $value, $id)
{
$sql = "UPDATE $table SET $column = '$value' WHERE id = $id";
$this->query($sql);
return $this->query_result;
}
Şimdi, işlem dosyası 1 ve 2 gayet iyi çalışıyor. Benim DB ben uzantısı ile tüm dosya görebilirsiniz.
Ben dosyayı 3 işlemek Ama, dosya moods_logo_custom.jp
veya moods_logo_custom.
olarak depolanır ya. Ben bile 'Copy of (Custom).jpg
' kullanarak denedim ve gayet iyi çalışıyor.
Sorguyu çağırmadan önce bir yankı, $ dosya doğru olduğunu gösterir.
Yani yeryüzünde ne özel dosya fale BU yapar? Neden DB tüm dosya saklamak değildir?