CodeIgniter Forums
where i get the information about upload files? - 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: where i get the information about upload files? (/thread-9871.html)



where i get the information about upload files? - El Forum - 07-10-2008

[eluser]Asinox[/eluser]
Hi, im trying to upload file, and all is fine...but now i want to save the information about this file in my data base...but how ill get this information?, ┬┐how i get the name of file? type, etc?

Thansk Smile


where i get the information about upload files? - El Forum - 07-11-2008

[eluser]Seppo[/eluser]
Quote:$this->upload->data()
This is a helper function that returns an array containing all of the data related to the file you uploaded. Here is the array prototype:

Array
(
[file_name] => mypic.jpg
[file_type] => image/jpeg
[file_path] => /path/to/your/upload/
[full_path] => /path/to/your/upload/jpg.jpg
[raw_name] => mypic
[orig_name] => mypic.jpg
[file_ext] => .jpg
[file_size] => 22.2
[is_image] => 1
[image_width] => 800
[image_height] => 600
[image_type] => jpeg
[image_size_str] => width="800" height="200"
)
http://ellislab.com/codeigniter/user-guide/libraries/file_uploading.html


where i get the information about upload files? - El Forum - 07-11-2008

[eluser]Asinox[/eluser]
Thanks... but how i pass this data to my function model to save data?

Thanks


where i get the information about upload files? - El Forum - 07-11-2008

[eluser]Seppo[/eluser]
as a parameter? That depends on your code... I don't know what you are doing internally


where i get the information about upload files? - El Forum - 07-11-2008

[eluser]Bramme[/eluser]
[quote author="Asinox" date="1215807912"]Thanks... but how i pass this data to my function model to save data?

Thanks[/quote]$this->upload->data() returns an array...

So you could do:
Code:
$data = $this->upload->data();
$insert['filename'] = $data['file_name'];
$this->db->insert('table', $insert);



where i get the information about upload files? - El Forum - 07-11-2008

[eluser]Asinox[/eluser]
Thanks Smile

Gr8! Smile