Welcome Guest, Not a member yet? Register   Sign In
File Upload difficulties
#2

[eluser]lefrog[/eluser]
Is your

$this->upload->do_upload();

in the same controller

I used the upload class recently and the data was there, here's my function

function upload_image($path, $name)
{
$rules['upload_path'] = $path;
$rules['allowed_types'] = 'jpg';
$rules['overwrite'] = true;
$this->load->library('upload', $rules);
// if the upload is not a gallery item
if ($name != "orig") {
$_FILES['userfile']['name'] = $name;
}
if ( ! $this->upload->do_upload() )
{
die($this->upload->display_errors());
}
// if the upload is a gallery item we need to return the filename so we can manipulate it
if ($name == "orig") {
$upload_data = $this->upload->data();
$temp_name = substr($upload_data['orig_name'], 0, -4);
//$new_path = substr($path, 2);
$old_name = $path . $upload_data['orig_name'];
$new_name = $path . $temp_name . ".jpg";
//die($old_name . " " . $new_name);
rename($old_name, $new_name);
return $upload_data['orig_name'];
}
}


Messages In This Thread
File Upload difficulties - by El Forum - 09-03-2007, 11:51 AM
File Upload difficulties - by El Forum - 09-03-2007, 04:45 PM
File Upload difficulties - by El Forum - 09-03-2007, 05:03 PM
File Upload difficulties - by El Forum - 09-04-2007, 02:41 PM



Theme © iAndrew 2016 - Forum software by © MyBB