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

[eluser]Rumel[/eluser]
when i upload pdf file this time an error . pdf file is not uploaded. but jpg, gif file is uploaded. please help me .
#2

[eluser]mvdg27[/eluser]
See the user guide here: http://ellislab.com/codeigniter/user-gui...ading.html and search for the'allowed_type' preference.

Regards, Michiel
#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.
#4

[eluser]mvdg27[/eluser]
Perhaps your PDF is larger than the allowed 100kb you have configured now?

Code:
$config[‘max_size’]  = ‘100’;
#5

[eluser]mbtshoes[/eluser]
view page:
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Upload Form&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;?php echo $error;?&gt;

&lt;?php echo form_open_multipart(‘basic/do_upload’);?&gt;

&lt;input type=“file” name=“userfile” size=“20” /&gt;



&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.
mbt shoes ,mbt outlet,discount mbt shoes,cheap mbt shoes,mbt shoes sale
#6

[eluser]Rumel[/eluser]
when i upload the pdf file this time show this error massage:

The filetype you are attempting to upload is not allowed.

please help me any one.




Theme © iAndrew 2016 - Forum software by © MyBB