Welcome Guest, Not a member yet? Register   Sign In
uploading file on server error
#1

[eluser]Dan Tdr[/eluser]
hey guys.. i kind of having a problem when i`m uploading a file on a server.. i don`t get that error on my localhost.. but when the website is on a server it just won`t upload.. let me show you the code and hopefuly someone would help

controller:
Code:
function avatar()
    {
        //UPLOAD
        $config['upload_path'] = './uploads/avatar';
        $config['allowed_types'] = 'jpg';
        $config['max_size']    = '5000';
        $config['max_width']  = '5000';
        $config['max_height']  = '5000';
        
        $this->load->library('upload', $config);
        $this->upload->do_upload();
        
        $data = array('upload_data' => $this->upload->data());
        $file_data = $this->upload->data();
        
        $file_raw = $file_data['raw_name'];
        $file_name = $file_data['orig_name'];
        $file_ext = $file_data['file_ext'];
        $file_size = $file_data['file_size'];
  
          $this->_container = $this->config->item('FAL_template_dir').'template/container';
        $this->_upload_success = $this->config->item('FAL_template_dir').'template/upload_success';
        $id = $this->uri->segment(3);
        $data['heading'] = 'VIEW users';
        $data['controller'] = 'myaccount';
        $data['page'] = $this->config->item('FAL_template_dir').'template/upload_success';
                        
        $this->load->vars($data);
        
        $this->load->view($this->_container, $data);  
  
       //SAVE IN DATABASE
        $this->load->model('model_imageboard','', TRUE);
        $this->model_imageboard->insert_avatar();
        $data['file_name'] = $file_name;
    }

model:
Code:
function insert_avatar()
{        
        
        $this->load->library('upload');
        $this->upload->do_upload();
        
        $data = array('upload_data' => $this->upload->data());
        $file_data = $this->upload->data();
        
        $file_raw = $file_data['raw_name'];
        $file_name = $file_data['file_name'];
        $file_ext = $file_data['file_ext'];
        $file_size = $file_data['file_size'];
        $file_width = $file_data['image_width'];
        $file_height = $file_data['image_height'];
          $id = getUserProperty('id');
      //  $user_ip = '127.0.0.1';
      //  $file_hash = 'myhash';
        $file_ext = '.jpg';
        $file_size = 'file_size';
        $file_height = '600';
        $file_width = '800';
     //   $file_source = 'http://www.seinkraft.com/';
        
        $this->db->query("UPDATE fa_user SET avatar = '$file_raw' WHERE id = $id");
    }

uploading form:
Code:
<?php echo form_open_multipart('upload/do_upload');?>

<input type="file" name="userfile" size="20" />

<input type="submit" value="upload" />

</form>
upload success:
Code:
<h3>Your file was successfully uploaded!</h3>

<ul>
&lt;?php foreach($upload_data as $item => $value):?&gt;
<li>&lt;?php echo $item;?&gt;: &lt;?php echo $value;?&gt;</li>
&lt;?php endforeach; ?&gt;
</ul>

<p>&lt;?php echo anchor('upload', 'Upload Another File!'); ?&gt;</p>

displaying the image:
Code:
<img src="&lt;?=base_url().'uploads/avatar/'.$user['avatar']." class="avatar"/>

ok so when i`m uploading the picture on my localhost after i get this :
Code:
Your file was successfully uploaded!

    * file_name: 19.jpg
    * file_type: image/jpeg
    * file_path: E:/xphpx/xampp/htdocs/ARTcrew/uploads/avatar/
    * full_path: E:/xphpx/xampp/htdocs/ARTcrew/uploads/avatar/19.jpg
    * raw_name: 19
    * orig_name: 1.jpg
    * file_ext: .jpg
    * file_size: 13.55
    * is_image: 1
    * image_width: 320
    * image_height: 301
    * image_type: jpeg
    * image_size_str: width="320" height="301"

Upload Another File!

when i`m uploading the file on the webserver i get :
Code:
* file_name:
    * file_type:
    * file_path: /www/ftp.webserver.ro/webserver.ro/ARTcrew/uploads/avatar
    * full_path: /www/ftp.webserver.ro/webserver.ro/ARTcrew/uploads/avatar
    * raw_name:
    * orig_name:
    * file_ext:
    * file_size:
    * is_image:
    * image_width:
    * image_height:
    * image_type:
    * image_size_str:

Upload Another File!

on the localhost the file is uploaded but in the webserver it does not.. could some one help me please?
any advices or anything at all?
thanks
#2

[eluser]gp177[/eluser]
Did you check that the apache user or IIS user has the correct permissions?
#3

[eluser]Dan Tdr[/eluser]
how could i do that?




Theme © iAndrew 2016 - Forum software by © MyBB