Welcome Guest, Not a member yet? Register   Sign In
codeigniter file uploaded path
#11

[eluser]Chilukuri Bhaskar[/eluser]
<?php

following condition not checking properly

if($this->upload->do_upload())
{
echo 'working';exit;
$data = array('upload_data' => $this->upload->data());
$this->load->model('artist_model');
$uploadedData = $this->upload->data();
$FileName = $uploadedData['file_name'];
$this->artist_model->addBiography($FileName);
$this->load->view('addBiography',$data);


}
?>
#12

[eluser]Sanjay Sarvaiya[/eluser]
please use [code] your code will be here [/code] for code posting.
which version of CI you are using?
can you paste your view code?
#13

[eluser]Chilukuri Bhaskar[/eluser]
Code:
<form action="<?php echo base_url() ?>newartist/addBiography" method="post" enctype="multipart/form-data" name="" id="">
    <table width="100%" border="0" cellspacing="3" cellpadding="0">
      <tr>
        <td>&nbsp;</td>
        <td>&lt;?php
   if(isset($error))
   {
    echo $error;
   }
  
   ?&gt;</td>
      </tr>
      <tr>
        <td><label for="name">Artist Name</label></td>
        <td>&lt;input type="text" name="name" id="name" class="bioinput" /&gt;&lt;/td>
      </tr>
      <tr>
        <td><label for="location">Artist Location</label></td>
        <td>
          &lt;input type="text" name="location" id="location" class="bioinput" /&gt;&lt;/td>
      </tr>
      <tr>
        <td><label for="dob">Artist Date of birth</label></td>
        <td>
          &lt;input type="text" name="dob" id="dob" class="bioinput" /&gt;&lt;/td>
      </tr>
      <tr>
        <td><label for="bio">Artist Biography</label></td>
        <td>&lt;textarea name="bio" id="bio" cols="45" rows="5"&gt;&lt;/textarea></td>
      </tr>
      <tr>
        <td><label for="userfile">Profile Photo</label></td>
        <td>
          &lt;input type="file" name="userfile" id="userfile" /&gt;&lt;/td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td><button class="btn btn-primary" type="submit">Submit</button></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table>
  &lt;/form&gt;
#14

[eluser]Sanjay Sarvaiya[/eluser]
Everything seem OK.
try this.
Code:
$this->upload->do_upload('userfile')
#15

[eluser]Chilukuri Bhaskar[/eluser]
Please check this condition is it okay because i am getting same error

Code:
if($this->upload->do_upload('userfile'))
     {
     echo 'working';exit;
   $data = array('upload_data' => $this->upload->data());
    $this->load->model('artist_model');    
    $uploadedData = $this->upload->data();
    $FileName = $uploadedData['file_name'];
    $this->artist_model->addBiography($FileName);
    $this->load->view('addBiography',$data);
    
    
     }
#16

[eluser]Sanjay Sarvaiya[/eluser]
condition is OK.

The uploading file type must be "gif,jpg,jpeg,png".
during upload other types of file you get error message like "The filetype you are attempting to upload is not allowed."


#17

[eluser]Chilukuri Bhaskar[/eluser]
allowed types are

$config['allowed_types'] = 'gif|jpg|jpeg|png|JPEG|PNG';

i am uploading .jpeg image
#18

[eluser]Chilukuri Bhaskar[/eluser]
Please check this code

Code:
if(!$this->upload->do_upload())
     {
     //echo 'working';exit;
   $data = array('upload_data' => $this->upload->data());
    $this->load->model('artist_model');    
    $uploadedData = $this->upload->data();
    $FileName = $uploadedData['file_name'];
    $this->artist_model->addBiography($FileName);
    $this->load->view('addBiography',$data);
    
    
     }

putting not symbol it's inserting in database but not moving related file to uploaded folder
#19

[eluser]Sanjay Sarvaiya[/eluser]
Hey man
you are doing wrong.

The file uploading function $this->upload->do_upload() return TRUE or FALSE;
Code:
if(!$this->upload->do_upload()) {
   // some error during uploading.
}
else {
// file uploaded successfully.
}
.

I have sent you personal message plz check.
#20

[eluser]Chilukuri Bhaskar[/eluser]
I have sent files if any wrong let me know i will send again




Theme © iAndrew 2016 - Forum software by © MyBB