Welcome Guest, Not a member yet? Register   Sign In
Problem uploading photos online
#1

[eluser]adekenny[/eluser]
Hi,

I'm using codeigniter for a project that requires that users upload their photos after completing an online form. The code worked perfectly on my local system (developement system) but didn't work online on my hosting company's server.

I keep getting this message "The upload path does not appear to be valid".

Please see my controller code

<?php

class Upload extends Controller {

function __construct()
{
parent::__construct();
$this->load->helper(array('form', 'url'));
}

function index()
{
$this->load->view('upload_form', array('error' => ' ' ));
}

function do_upload()
{
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '50';
$config['max_width'] = '900';
$config['max_height'] = '600';

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

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);
}
}
}
?>

I have already created a folder called "uploads" in my Public_html folder which is the web root folder but couldn't just get it to work online.

What could be the problem pleaseeeeeeeeee? How do i determine the correct upload path on my remote web server.

Thanks
kenny

#2

[eluser]rheritahiana[/eluser]
Up!

got exactly the same problem, been watching around for a few days now, i can't find any solution.

Any lead?
#3

[eluser]Mauricio de Abreu Antunes[/eluser]
I think in your remote server you need FULL PATH starting from root folder, no?
Another TIP:

Don't create your upload in your controller.
Create a lib for this and call its methods in your controller.
This way, you will create 1 controller for each form or just one. Smile


Ok?
#4

[eluser]InsiteFX[/eluser]
Try this:
Code:
$config['upload_path'] = APPPATH . '../uploads/';




Theme © iAndrew 2016 - Forum software by © MyBB