Welcome Guest, Not a member yet? Register   Sign In
image upload problem
#1

[eluser]Mitja[/eluser]
Code:
<input type="file" name="title_photo" />

Code:
if (!$this->upload->do_upload($field_name))
            {
                $error = array(
                    'error' => $this->upload->display_errors('<div class="warning">', '</div>'),
                    'title' => "Dodaj aranžma"
                );
                
                $this->load->view('admin/arrangements_add', $error);
            }    
            else
            {

if image is not choose i get error that image was not choose. I do now always want to choose image when i am inserting into databse. How can i prevent this that image is not rewuired.

thx
#2

[eluser]Mitja[/eluser]
can i somehow check if image was choose to upload or not.
#3

[eluser]gtech[/eluser]
yes simplest way, after the form has been submitted if you are using title_photo as a variable name to post the file location to the upload logic.. you could check if title_photo is blank or not.
Code:
...
  if (!$this->input->post('title_photo', true) == '')
  {
    if (!$this->upload->do_upload($field_name))
    {
    ...
  }
or somthing like that, before you make the call to do_upload.
#4

[eluser]Mitja B.[/eluser]
http://si.php.net/features.file-upload
#5

[eluser]Sarfaraz Momin[/eluser]
Well there can be a small change in gtech code

Code:
if($_FILES)
  {
    if (!$this->upload->do_upload($field_name))
    {

    }
  }
lemme know if this works for you since it does for me

have a good day !!!




Theme © iAndrew 2016 - Forum software by © MyBB