Welcome Guest, Not a member yet? Register   Sign In
file upload in multiple paths
#1

[eluser]PHP Programmer[/eluser]
I am trying to upload files in two different paths by residing in a single form.

I have two fields - Photo Uplaod (Requires .jpg|.gif|.png ) and Resume Upload (Requires .doc|.rtf)

I am trying following:

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

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

<br /><br />

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

&lt;/form&gt;

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

$config1['upload_path'] = './uploads/file2/';
$config1['allowed_types'] = 'gif|jpg|png';
$config1['max_size'] = '100';
$config1['max_width'] = '1024';
$config1['max_height'] = '768';

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

$this->upload->initialize($config);
$this->upload->initialize($config1);
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 it is not uploading the files in both folders (file1 and file2). How can I solve this problem?


Messages In This Thread
file upload in multiple paths - by El Forum - 09-19-2008, 01:14 AM
file upload in multiple paths - by El Forum - 09-19-2008, 01:42 AM
file upload in multiple paths - by El Forum - 09-19-2008, 02:11 AM
file upload in multiple paths - by El Forum - 09-19-2008, 02:16 AM
file upload in multiple paths - by El Forum - 09-19-2008, 02:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB