I need a help regarding amazon s3 with folders,
The problem I get with the Amazon s3 class by undesigned is it doesn't support folders, it will only show you the full file name it gives you these three options out off the array.
[Music/] => Array
(
[name] => Music/
[time] => 1296576896
[size] => 0
[hash] => d41d8cd98f00b204e9800998ecf8427e
)
[Music/Cocaine VIP_Shufunk_192.mp3] => Array
(
[name] => Music/dnb/Cocaine VIP_Shufunk_192.mp3
[time] => 1296577893
[size] => 8300933
[hash] => edfb1bcfad7edfaccd901b95541e8d45
)
[Music/dnb/Crazy Talk_Tantrum Desire_192.mp3] => Array
(
[name] => Music/dnb/Crazy Talk_Tantrum Desire_192.mp3
[time] => 1296577988
[size] => 9266562
[hash] => 0eb4ca6b53d78e1f976df9b488e0f4bf
)
[Music/dnb/Day_N_Nite_(TC_Remix)_Kid_Cudi_vs._Crookers_192.mp3] => Array
(
[name] => Music/dnb/Day_N_Nite_(TC_Remix)_Kid_Cudi_vs._Crookers_192.mp3
[time] => 1296578094
[size] => 6597705
[hash] => 376ed9479afc9657b40bc4fc3e885b65
)
so as you can see it gives you the options name time size and hash no folders options so i am trying to find a work around.
from above as you can see Cocaine VIP_Shufunk_192.mp3 is in the Music folder and their is also a folder Music/dnb/ which contains lots of files.
What I am looking to do is find a what just to show files that are within a certain folder.
so far I've tried.
ok so if i have a folder called Music
i can have the following.
$amazon_folder = "Music";
$contents = $s3->getBucket("MY-BUCKET",$amazon_folder);
foreach ($contents as $file){
$fname = $file['name'];
// So i need some code
}
ok so this will show all my files within music but the problem with this is it shows everything including folders within the music folder.
I dont want it to show files that are within a folder within the music folder say Music/Dnb i dont want it to show these files only files within the Music folder not the Music/dnb folder???
i have tried the following.
$test = substr($fname, 0, strpos($fname, '/'));
$more = explode("/", $fname);
Can anyone get me a solution to this???