Welcome Guest, Not a member yet? Register   Sign In
Uploaded file data
#1

[eluser]Unknown[/eluser]
Hi everyone,

I've just started using CodeIgniter and I'm a little confused, so please forgive me if I'm asking anything too stupid.

Ok, so I'm using the File Uploader library and then loading a custom library that will then upload the file to a container in CloudFiles. The file uploader works; the uploader to CloudFiles works. The problem I'm having is when I try to get the name of the file from the $data array to then use as a parameter.

My code is as follows:
Code:
$data = array('upload_data' => $this->upload->data());
$this->load->library('CloudFiles');
$this->cloudfiles->uploadFile($data["file_name"]);
$this->load->view('upload_success', $data);

Any thoughts?
#2

[eluser]danmontgomery[/eluser]
Most likely you need to include the path along with the filename... Would you care to elaborate on what the problem you're having is?
#3

[eluser]sofwan[/eluser]
Try this :

$data= $this->upload->data();
foreach($data as $value)
{
//Get an Uploaded file name
$xfile_name=$value;
break;
}
#4

[eluser]Unknown[/eluser]
I've figured out what I was doing wrong (with a bit of help, admittedly). I needed to use
Code:
$data['upload_data']['file_name']
rather than
Code:
$data['file_name']




Theme © iAndrew 2016 - Forum software by © MyBB