c_shelswell Posted March 25, 2008 Share Posted March 25, 2008 Hi i've got an array from a class in uber uploader and i'm struggling to extract the data from it i need. Here's a print output from the screen: Array ( [0] => fileinfo Object ( [slot] => upfile_0 [name] => BACK2.jpg [size] => 48853 [type] => image/pjpeg ) [1] => fileinfo Object ( [slot] => upfile_3 [name] => videodivxtest_13.zip [size] => 252573 [type] => application/x-zip-compressed ) [2] => fileinfo Object ( [slot] => upfile_1 [name] => musictest_13.zip [size] => 252573 [type] => application/x-zip-compressed ) [3] => fileinfo Object ( [slot] => upfile_2 [name] => videompegtest_12.zip [size] => 252573 [type] => application/x-zip-compressed ) ) I know that the slot label will always be the same i.e. upfile_1, upfile_2 etc what i'm needing to extract is the file name at slot upfile_1. I was expecing something along the lines of: $fileThree = $_FILE_DATA['upfile_3']->getFileInfo('name'); if that makes sense?? If anyone could help that'd be great. Cheers Link to comment https://forums.phpfreaks.com/topic/97789-can-some-one-help-me-with-this-array/ Share on other sites More sharing options...
trq Posted March 25, 2008 Share Posted March 25, 2008 $fileThree = $_FILE_DATA[2]->name; Link to comment https://forums.phpfreaks.com/topic/97789-can-some-one-help-me-with-this-array/#findComment-500330 Share on other sites More sharing options...
c_shelswell Posted March 25, 2008 Author Share Posted March 25, 2008 You see that's the problem i had initally expexted that the array would stay in order but it doesn't seem to. i.e $_FILE_DATA[1] would always hold upfile_1. Instead it seems to hold upfile_3 so i was hoping to ask: "give me the file name in upfile_3" Is that possible? Cheers Link to comment https://forums.phpfreaks.com/topic/97789-can-some-one-help-me-with-this-array/#findComment-500332 Share on other sites More sharing options...
trq Posted March 25, 2008 Share Posted March 25, 2008 <?php foreach ($_FILE_DATA as $obj) { if ($obj->slot = 'upfile_1') { echo $obj->name; } } ?> Link to comment https://forums.phpfreaks.com/topic/97789-can-some-one-help-me-with-this-array/#findComment-500335 Share on other sites More sharing options...
c_shelswell Posted March 25, 2008 Author Share Posted March 25, 2008 perfect thanks very much for your help!!! Link to comment https://forums.phpfreaks.com/topic/97789-can-some-one-help-me-with-this-array/#findComment-500337 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.