Hi,
I have a folder with full of images.But I have to upload the images to mysql database.
How can I do it using php code?
Regards,
Rekha
Hi,
I have a folder with full of images.But I have to upload the images to mysql database.
How can I do it using php code?
Regards,
Rekha
I am not store image in DB. It is a bad practice. If we have a some ID, we rename images as image$ID.ext. If we haven't ID, we write in DB only a filename. If you want to write in database all filenames of dir, try to use this code:
function getDirectoryList ($directory) {
$results = array();
$handler = opendir($directory);
while ($file = readdir($handler)) {
if ($file != "." && $file != "..") {
$results[] = $file;
}
}
closedir($handler);
return $results;
}