Utiliza este codigo a mi me funciona perfecto y se crea el thumb .
Código PHP:
Ver originalFuncion:
function do_upload() {
//PASAMOS VALORES DEL PDF
if ($_POST["action"] == "upload")
{
// obtenemos los datos del archivo
$tamano = $_FILES["archivo"]['size'];
$tipo = $_FILES["archivo"]['type'];
$archivo = $_FILES["archivo"]['name'];
if ($archivo != "")
{
// guardamos el archivo a la carpeta ficheros
$destino = "assets/pdf/".$archivo;
if (copy($_FILES['archivo']['tmp_name'],$destino)){} }
}
//SI EL FORMULARIO PASA LA VALIDACIÓN HACEMOS TODO LO QUE SIGUE
$config['upload_path'] = './assets/img/slides/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '2000000000';
$config['max_width'] = '20000000024';
$config['max_height'] = '200000008';
$this->load->library('upload', $config);
//SI LA IMAGEN FALLA AL SUBIR MOSTRAMOS EL ERROR EN LA VISTA UPLOAD_VIEW
if (!$this->upload->do_upload()) {
$error = array('error' => $this->upload->display_errors()); $this->load->view('upload_view', $error);
} else {
//EN OTRO CASO SUBIMOS LA IMAGEN, CREAMOS LA MINIATURA Y HACEMOS
//ENVÍAMOS LOS DATOS AL MODELO PARA HACER LA INSERCIÓN
$file_info = $this->upload->data();
//USAMOS LA FUNCIÓN create_thumbnail Y LE PASAMOS EL NOMBRE DE LA IMAGEN,
//ASÍ YA TENEMOS LA IMAGEN REDIMENSIONADA
$this->_create_thumbnail($file_info['file_name']);
$data = array('upload_data' => $this->upload->data()); $titulo = $this->input->post('titulo');
$imagen = $file_info['file_name'];
$subir = $this->M_galeria->subir($titulo,$imagen,$archivo);
$data['titulo'] = $titulo;
$data['imagen'] = $imagen;
Redirect('Home');
}
}
Código PHP:
Ver original<?=form_open_multipart(base_url()."galeria/Galeria/do_upload")?>
<label>Descripcion:</label><input type="text" name="titulo" /><br><br><br>
<input name="action" type="hidden" value="upload" />
<label>AGREGAR PDF</label>
<input name="archivo" type="file" id="archivo" size="35" /> <br><br><br>
<label>Agregar Imagen</label><input type="file" name="userfile" /><br><br><br>
<input type="submit" value="Subir imágenes" />
<?=form_close()?>