[eluser]behnampmdg3[/eluser]
Hello;
Trying ti upload a csv but I get this error.
Any ideas?
Thank you.
Code:
<?php
$attributes = array('name' => 'upload_csv', 'id' => 'upload_csv');
echo form_open_multipart('upload_csv/check/'.$id, $attributes);
$file_data = array('name' => 'file');
echo form_upload($file_data);
$submit_data = array('name' => 'submit', 'value' =>'Upload');
echo form_submit($submit_data);
?>
Code:
if($_POST)
{
print_r($_POST);
print_r($_FILES);
/*prints: Array ( [submit] => Upload ) Array ( [file] => Array ( [name] => template_379.csv [type] => text/csv [tmp_name] => /tmp/phpo7I5JX [error] => 0 [size] => 35 ) ) */
$config['upload_path'] = '/uploads/';
$config['allowed_types'] = 'csv';
$config['max_size'] = '100';
$this->load->library('upload', $config);
if (!$this->upload->do_upload($file))
{
$data['error'] = array('error' => $this->upload->display_errors());
}
else
{
$data = array('upload_data' => $this->upload->data());
}
}