Welcome Guest, Not a member yet? Register   Sign In
how to upload file with CI?
#1

[eluser]Unknown[/eluser]
I already did on the tutorial but it show this message please help?
"The upload path does not appear to be valid."
where is my code in controller/upload.php

<?php
class Upload extends Controller
{
function Upload()
{
parent::Controller();
$this->load->helper('html');
$this->load->helper('form');
$this->load->helper('url');
$this->load->library('upload');
}
function index()
{

$link = array(
'href'=>'system/application/views/themes/Sky/sky_css.css',
'rel'=>'stylesheet',
'type'=>'text/css'
);
$data['link_css']=link_tag($link);
$icon=array(
'href'=>'system/application/views/themes/Sky/Cresittel.ico',
'rel'=>'shortcut icon',
'type'=>'image/ico'
);
$data['myicon']=link_tag($icon);

$data['title']='Uploading file with CodeIgniter Framework';
$data['Heading']='Upload file';
$image_properties = array(
'src' => 'system/application/views/themes/Sky/logo.jpg',
'alt' => 'www.cresittel.com',
'class' => 'header-weaper',
'title'=>'http://www.cresittel.com'
);

$data['myimg']=img($image_properties);
$data['error']='';
$this->load->view('Upload_view',$data);


}
function do_upload()
{
$link = array(
'href'=>'system/application/views/themes/Sky/sky_css.css',
'rel'=>'stylesheet',
'type'=>'text/css'
);
$data['link_css']=link_tag($link);
$icon=array(
'href'=>'system/application/views/themes/Sky/Cresittel.ico',
'rel'=>'shortcut icon',
'type'=>'image/ico'
);
$data['myicon']=link_tag($icon);

$data['title']='Uploading file with CodeIgniter Framework';
$data['Heading']='Upload file';
$image_properties = array(
'src' => 'system/application/views/themes/Sky/logo.jpg',
'alt' => 'www.cresittel.com',
'class' => 'header-weaper',
'title'=>'http://www.cresittel.com'
);

$data['myimg']=img($image_properties);
$data['error']='';

$config['upload_path'] = "./system/";
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '2048';
$config['max_width'] = '1024';
$config['max_height'] = '768';

$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
$data['error'] = $this->upload->display_errors();

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

$data['Heading']='Upload File successful ';

$this->load->view('upload_success_view', $data);
}
/* $this->load->library('Multi_upload');
$files=$this->multi_upload->go_upload();

if ( ! $files )
{
$data['error'] = $this->upload->display_errors();
$this->load->view('Upload_view', $data);
}
else
{
$data = array('upload_data' => $files);
$data['Heading']='Upload File successful ';
$this->load->view('upload_success_view', $data);
}
*/
}
}
?>
#2

[eluser]SitesByJoe[/eluser]
Did you allow write permissions for the folder you want to upload to?
#3

[eluser]Jan_1[/eluser]
maybe try the whole serverpath, not just the CI-path




Theme © iAndrew 2016 - Forum software by © MyBB