10-16-2008, 01:00 AM
[eluser]bhakti.thakkar[/eluser]
hi all,
i am trying to upload file but it isnt working. below in the code in MVC:
view.php
Code in the controller:
ncs.php:
No error messages also displayed. files also not uplaoded in the specified path. just a blank page. i have checked the directory access also (CHMOD = 777)
Please help me
Thanks
hi all,
i am trying to upload file but it isnt working. below in the code in MVC:
view.php
Code:
<?php echo form_open_multipart('ncs/do_upload/' . $row->NonConformity_ID, array('id'=>'private_note_form'));?>
<h4>Upload evidence document(s) </h4>
<p>
<input name="userfile" type="file" id="userfile" />
</p>
<p>
<input type="submit" name="submit" value="Add files" />
</p>
<?php echo form_close();?>
Code in the controller:
ncs.php:
Code:
function do_upload($id)
{
$this->load->model('evidence_upload_model');
$directory="HTTP://".$_SERVER['SERVER_NAME']."/files/Appl_files/";
$config['upload_path'] = $directory;
$config['max_size'] = '16777215';
$config['max_width'] = '3000';
$config['max_height'] = '3000';
$this->load->library('upload'); // load if it hasn't already been loaded
$this->upload->initialize($config); // pass the settings to the library
$data = array('upload_data' => $this->upload->data());
print_r($config);
if(!$this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());
// return FALSE;
// print "not done";
}
else
{
print "done";
// return TRUE;
}
// $this->session->set_flashdata('message', 'success in file upload');
// redirect('ncs/view/' . $id);
}
No error messages also displayed. files also not uplaoded in the specified path. just a blank page. i have checked the directory access also (CHMOD = 777)
Please help me
Thanks