Welcome Guest, Not a member yet? Register   Sign In
"The upload path does not appear to be valid"
#1

[eluser]Unknown[/eluser]
Guys pliss help me..
I have a problem with upload image. I try submit upload image with my form, but I get this error:

"The upload path does not appear to be valid"

This my directory:
Quote:/application
/bootstrap
//css
//img
//js
/system
/uploads


this is my view...
Quote:<?php echo form_open_multipart('admin/halamanadmin/tambahberita'); ?>
<table class="table table-bordered table-condensed">
<tr>
<td>
&lt;input type="text" name="judul"&gt;
</td>
</tr>
<tr>
<td>
&lt;input type="file" name="userfile"&gt;
</td>
</tr>
<tr>
<td>
<button class="btn btn-primary" type="submit">Simpan</button>
</td>
</tr>
</table>
&lt;?php echo form_close(); ?&gt;

and this is my controller
Quote:public function tambahberita()
{
$config['upload_path'] = 'uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '300';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);

if ( ! $this->upload->do_upload())
{
$error = $this->upload->display_errors();

print_r($error);
}
else
{
$data = $this->upload->data();

print_r($data);
}
}

and this is my autoload:
Quote:$autoload['libraries'] = array('upload','database', 'session', 'javascript', 'form_validation', 'table', 'pagination');
$autoload['helper'] = array('url','text','form', 'file', 'html');
#2

[eluser]jairoh_[/eluser]
try changing
Code:
$config[‘upload_path’] = ‘uploads/’;

into
Code:
$config[‘upload_path’] = "./uploads/";
or
Code:
$config[‘upload_path’] = base_url() . "uploads/";
or
Code:
$config[‘upload_path’] = site_url() . "uploads/";
#3

[eluser]CroNiX[/eluser]
@jairoh, have you actually tried your advise by using base_url/site_url? File paths are not URLs, so those wont work.
#4

[eluser]jairoh_[/eluser]
[quote author="CroNiX" date="1372714565"]@jairoh, have you actually tried your advise by using base_url/site_url? File paths are not URLs, so those wont work.[/quote]

oh i forgot though sorry. but he can try the first one.

from this:
Code:
$config[‘upload_path’] = ‘uploads/’;

to this:
Code:
$config[‘upload_path’] = ‘./uploads/’;




Theme © iAndrew 2016 - Forum software by © MyBB