Welcome Guest, Not a member yet? Register   Sign In
How can i upload pdf or any type of file
#3

[eluser]Rumel[/eluser]
view page:
<html>
<head>
<title>Upload Form</title>
</head>
<body>

<?php echo $error;?>

<?php echo form_open_multipart('basic/do_upload');?>

<input type="file" name="userfile" size="20" />

<br /><br />

&lt;input type="submit" value="upload" /&gt;

&lt;/form&gt;

&lt;/body&gt;
&lt;/html&gt;
my controller:
function upload()
{
$this->load->view('upload_form', array('error' => ' ' ));
}

function do_upload()
{
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png|pdf';
$config['max_size'] = '100';
$config['max_width'] = '1024';
$config['max_height'] = '768';

$this->load->library('upload', $config);

if ( ! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());

$this->load->view('upload_form', $error);
}
else
{
$data = array('upload_data' => $this->upload->data());

$this->load->view('upload_success', $data);
}
}

but not uploading pdf file. this code uploads jpg,gif,png file.how can i solve this problem please help me.


Messages In This Thread
How can i upload pdf or any type of file - by El Forum - 09-12-2010, 02:14 PM
How can i upload pdf or any type of file - by El Forum - 09-12-2010, 03:57 PM
How can i upload pdf or any type of file - by El Forum - 09-13-2010, 09:27 PM
How can i upload pdf or any type of file - by El Forum - 09-14-2010, 12:25 AM
How can i upload pdf or any type of file - by El Forum - 09-14-2010, 01:01 AM
How can i upload pdf or any type of file - by El Forum - 09-14-2010, 04:07 AM



Theme © iAndrew 2016 - Forum software by © MyBB