CodeIgniter Forums
extension filename cant show - 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: extension filename cant show (/thread-52764.html)



extension filename cant show - El Forum - 06-25-2012

[eluser]Unknown[/eluser]
dear all..
i'm trying to get filename with extension..but it cant show..
where's the problem..
here's my code
Code:
$bin = rand(00,99);
$kode = 60;
$namabaru=$bin.$kode;
$config['file_name']=$namabaru;
$config['upload_path'] = 'uploads/usulan';
$config['allowed_types'] = 'doc|docx|xls|xlsx';
$this->load->library('upload', $config);
$result = $this->upload->data();
foreach ($result as $item => $value){
     $filename = $result['file_name'];
     $ext = $result['file_ext'];

if ( ! $this->upload->do_upload()) {
echo $this->upload->display_errors();
}
else{
echo $filename.$ext;
}
with this code, the result is only filename without extension. and if i type
Code:
echo $ext;
theres only empty screen..


extension filename cant show - El Forum - 04-03-2013

[eluser]slowgary[/eluser]
This is an old post, but for anyone stumbling on it... my guess here is that $this->upload->data() doesn't contain any information until AFTER the call to $this->upload->do_upload().