I tried upload images. Some images not be able to upload. It shows successfully uploaded but doesn't goes to the folder and database. Below is my code
// Count total files
$countfiles = count($_FILES['files']['name']);
// Prepared statement
$query = "INSERT INTO images_list (name,location,sys_album_id)
VALUES (?,?,'".$_POST["albumid"]."')";
$statement = $conn->prepare($query);
// Loop all files
for($i=0;$i<$countfiles;$i++){
// File name
$strtotime = strtotime("now");
$filename = $strtotime.'_'.$_FILES['files']['name'][$i];
$albumid = $_POST['albumid'];
// Get extension
$ext = end((explode(".", $filename)));
// Valid image extension
$valid_ext = array("png","jpeg","jpg");
if(in_array($ext, $valid_ext)){
$rawBaseName = pathinfo($name, PATHINFO_FILENAME );
$extension = pathinfo($name, PATHINFO_EXTENSION );
$counter = 0;
while(file_exists("filer/".$albumid."/".$name)) {
$fname = $rawBaseName . $counter . '.' . $extension;
$counter++;
};