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

Hi,

I am trying to upload a file on live server cPanel but it not uploading and i am getting the error 
Code:
The upload path does not appear to be valid.

and some time 500-internal server error

But the thing is same code is running on my local machine wamp and every thing is perfect. I give full permissions to the upload folder and upload folder is on root where index.php is there

Controller:
PHP Code:
<?php
defined
('BASEPATH') OR exit('No direct script access allowed');

class 
Careers extends CI_Controller {
    
     function 
__construct(){
 
       parent::__construct();
 
       $this->load->library(array('upload','session','javascript','encrypt','email','form_validation'));
    
$this->load->helper(array('form','text','html','url','email','lang','file','directory')); 
 
       $this->load->driver(array('session'));
    
$this->load->model('Careers_model','model');
 
   }
    
    public function 
index($lang=false)
    {
        
$vars['lang'] =langhomename($lang);
        
$langid=langhomeid($lang);
        
$this->load->view('careers/index',$vars);
    }
    
    public function 
cvcareers($lang=false){  
        $vars
['lang'] =langhomename($lang);
        
$langid=langhomeid($lang);
 
           $this->model->cvcareers($vars);
 
     }
 
  


Model:
PHP Code:
<?php
class Careers_model extends CI_Model {

 
   public function __construct(){
 
       $this->load->database(); 
        }
        
    public function 
cvcareers($vars){
        
        
//getting values from the submitted form
        
$designation $_POST['career-designation'];
        
$email $_POST['career-email'];
 
           $name $_POST['career-name'];
        
$number $_POST['career-number'];
 
           $msg $_POST['career-msg'];    
        
$cvdata '';
        
        
//Uploading file to the directory
        
$config['upload_path'         './uploads/';
 
               $config['allowed_types'       'gif|jpg|png';
 
               $config['max_size'            1000;

 
               $this->load->library('upload'$config);
        if (!
$this->upload->do_upload('userfile'))
        {        
             
$vars['cv_status']= array('error' => $this->upload->display_errors());
             
print_r($vars);
             echo 
'Uploaderror';
        }
        else
        {
            
$cvdata$this->upload->data();
            
//assiging form data in array to pass to the database function
            
$data = array(
                    
'designation' => $designation,
                    
'email' =>$email,
                    
'name'=>$name,
                    
'number'=>$number,
                    
'message'=>$msg,
                    
'path'=>$config['upload_path'],
                    
//'cv' =>$cvdata['file_name'],
                    
'cv' =>'filename',
                );
            
//Inserting data into the database
            
$this->db->insert('careers'$data);
            
//Genrating email for sending,
            
$mailconfig['protocol'] = 'smtp';
            
$mailconfig['smtp_host'] = 'ssl://smtp.gmail.com'//change this
            
$mailconfig['smtp_port'] = '465';
            
$mailconfig['smtp_user'] = '@gmail.com'//change this
            
$mailconfig['smtp_pass'] = ''//change this
            
$mailconfig['mailtype'] = 'html';
            
$mailconfig['charset'] = 'iso-8859-1';
            
$mailconfig['wordwrap'] = TRUE;
            
$mailconfig['newline'] = "\r\n";
            
$this->load->library('email',$mailconfig);
            
$subject="CV";
            
//Genrating email template by entered user data 
            
$message =message($designation,$email,$name,$number,$msg,$cvdata);
            
            
//attaching file with the email 
            
$this->email->attach($cvdata["full_path"]);
            
$this->email->set_newline("\r\n");
            
$this->email->set_mailtype("html");
            
$this->email->from('@gmail.com');
            
$this->email->to('@gmail.com');
            
$this->email->subject($subject);
            
$this->email->message($message);

            if(
$this->email->send())
            {
            echo 
'Emailsent';
            }
            else
            {
            
//show_error($this->email->print_debugger());
                
$emailerror=$this->email->print_debugger();
            }
        }

    }    
    


    


.htaccess
PHP Code:
RewriteEngine on
Options 
-Indexes
RewriteCond 
%{REQUEST_FILENAME} !-f
RewriteCond 
%{REQUEST_FILENAME} !-d
RewriteRule 
.* index.php/$[L]
RewriteCond %{HTTP_HOST} ^sitename\.com$ [NC]
RewriteRule ^(.*)$ http://www.sitename.com/$1 [R=301,L]
Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS" 
Reply


Messages In This Thread
The upload path does not appear to be valid. - by ahsan - 12-14-2016, 02:23 AM



Theme © iAndrew 2016 - Forum software by © MyBB