[eluser]ywftdg[/eluser]
I have been trouble trying to get this renaming stuff to work at all, but no go. I tryed the latest post on here, but this causes a big error saying I cannot modify headers, etc...no idea. Has anyone out there mastered this uploading and renaming process? I am trying to take whatever they upload, set it to 777 and then rename it to $id + [ext]. Do I need to upload the item, then run another if statement to check for the file, then run the thumbnail and make a copy to get a new name? Right now the thumbnail doesn't work either if I add it into the current configs.
My current code (minus any renaming because it isnt working):
Code:
if ($this->input->post('mypageupdate')) {
// Designers Upload Folder
$dir = './assets/images/'.$id.'/';
// Make Directory
if (!is_dir($dir)) {
$theupload_path = mkdir('./assets/images/'.$id.'/', 0777);
}
$config['upload_path'] = $dir;
$config['allowed_types'] = 'gif|jpg|png';
$config['remove_spaces'] = TRUE;
$config['quality'] = '90';
$config['max_size'] = '1000000';
$this->upload->initialize($config);
if (!$this->upload->do_upload()) {
$data['error'] = 'There was a problem with your upload!';
} else {
$data = array('upload_data' => $this->upload->data());
$filepath = $data['upload_data']['file_name'];
$data = array(
$this->input->post('nickname'),
$this->input->post('bio'),
$this->input->post('web'),
$filepath
);
$this->designer->update_mypage($id,$data);
$this->session->set_flashdata('message', 'Mypage Updated!');
redirect('designers/mypage');
}
}