Welcome Guest, Not a member yet? Register   Sign In
File upload help needed
#1

[eluser]Computerzworld[/eluser]
Hello. I want a small help in uploading file code of codeigniter. I referred codeigniter user guide. But I was not able to upload file. I want to upload image on the localhost. How can I do it? If I take form_open_multipart()then it does not take file name as posted value in $this->input->post. It inserts 0 in database as filename.Please explain me with some simple code. Thanks in advance.
#2

[eluser]wiredesignz[/eluser]
CI uses a default upload filename of "userfile", like so:
Code:
<input type="file" name="userfile" size="32" />

Code:
//upload config
    $config['upload_path']   = './uploads/';
    $config['allowed_types'] = 'gif|jpg|png';
        
    $config['max_size']   = '1024';
    $config['max_width']  = '1024';
    $config['max_height'] = '768';
        
    $this->load->library('upload', $config);
        
    $this->upload->do_upload();
    $errors = $this->upload->display_errors();
#3

[eluser]Computerzworld[/eluser]
thanks for reply.... it workedSmile




Theme © iAndrew 2016 - Forum software by © MyBB