hi all,
i have this music website and i have to upload every album under this folder “newsongs” … in AlbumName folder i have normal quilty songs and HQ folder…under HQ folder i have High Quilty songs for each album.
i have this coding which moves Album folder and normal quilty songs to other folder “songs-category” but i also want to move subfolder “HQ” and High Quilty songs with AlbumName folder
AlbumName/all LQ songs > HQ/ HQ songs
[PHP]for($i=0;$i<=$ct;$i++)
{
$alb=$alname[$i];
$cat=$catname[$i];
$albids=$albid[$i];
$fon=$folder_name[$i];
$tmp_name=$doc_root."newsongs/$fon";
$uploads_dir=$doc_root."songs-category/$cat/$fon";
if ($handle = opendir($tmp_name)) {
/* This is the correct way to loop over the directory. */
while (false !== ($file = readdir($handle))) {
//echo "$file\n <br>";
if($file !=='..' and $file !=='.')
{
$song_path="songs-category/$cat/$fon/$file";
if(!is_dir("$tmp_name/$file") and (!is_dir("$uploads_dir/$file")))
{
if(copy("$tmp_name/$file", "$uploads_dir/$file"))
{
$cp=1;
$ext=substr($file,-4);
if($ext=='.mp3')
$insqry=mysql_query(" insert into tbl_songs set song_name='$file', album_id='$albids', artist_id='$artid', song_path='$song_path' ");
unlink($tmp_name.'/'.$file);
}
else
{
echo "could not move songs ";
}
}
}
if($insqry)
$msg="songs Added to the database";
else
$msg="songs Not Added to the database";
}
closedir($handle);
[/PHP]
thnx in advnce:thumbsup: