I'm trying to move the pictures to a new folder called new_images, but move_uploaded_file
isn't working. I tried copy($entry, $dir2);
that isn't working either. It's on a live site. Any suggestions?
$dir = $_SERVER['DOCUMENT_ROOT'].'/images/classifieds/'.$row['user_id'].'/ads/'.$row['listbingo_ad_id'].'';
if ($handle = opendir($dir)) {
//echo "Directory handle: $handle\n";
//echo "Entries:\n";
/* This is the correct way to loop over the directory. */
while (false !== ($entry = readdir($handle))) {
if($entry !="." && $entry !=".."){
$dir2 = $_SERVER['DOCUMENT_ROOT'].'/images/new_images/'.$entry;
move_uploaded_file($entry, $dir2);
echo "INSERT INTO tbl_classified_image (clsd_id,mem_id,cls_img_file,img_status) VALUES(".$row['listbingo_ad_id'].",6,'".$entry."','Y');\n";
}
}
}