CodeIgniter Forums
$this->upload->$data, trouble accessing array items - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: $this->upload->$data, trouble accessing array items (/thread-6527.html)



$this->upload->$data, trouble accessing array items - El Forum - 03-02-2008

[eluser]benmanson[/eluser]
Hi,

I am having trouble with what is probably a simple problem. I am trying to access the [file_name] and [file_path] items in the array $this->upload->data() that is produced when uploading files.

Can anyone point out how to do it? I have tried using a foreach loop and also using the array helper element() function. But I just can't seem to get it.

thanks
Ben


$this->upload->$data, trouble accessing array items - El Forum - 03-03-2008

[eluser]steelaz[/eluser]
This is how I did it, but I'm no expert. Also I'm uploading one file at a time.

Code:
$aFile = $this->upload->data();
$sPath = $aFile['full_path'];



$this->upload->$data, trouble accessing array items - El Forum - 03-03-2008

[eluser]benmanson[/eluser]
thanks steelaz - perfect, just what I needed. I knew it would be simple, just couldn't get it.


$this->upload->$data, trouble accessing array items - El Forum - 03-12-2008

[eluser]dark_lord[/eluser]
Nice answer stellaz! Thanks dude!