Jump to content


delete file

error file upload

  • Please log in to reply
14 replies to this topic

#1 Miguel Elendir

Miguel Elendir

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 10 December 2012 - 09:56 AM

I've installed crud in Codeigniter 1. I've changed model and control, removing "CI".

Then when I try to delete a file after you have uploaded, the file is not deleted. The symbol of the javascript runs constantly spinning. I examined with firebug and get a "page not found".

the file is not deleted from the folder, or database.

What could be the problem?

thank you very much

Attached Thumbnails

  • error.JPG


#2 victor

victor

    grocery CRUD Hero

  • Advanced Member
  • PipPipPip
  • 967 posts
  • LocationMinsk

Posted 11 December 2012 - 10:32 PM

Hi Miguel Elendir and welcome to the forum!
May be this page really doesn't exist :)

#3 victor

victor

    grocery CRUD Hero

  • Advanced Member
  • PipPipPip
  • 967 posts
  • LocationMinsk

Posted 11 December 2012 - 10:33 PM

show your path to function

#4 Miguel Elendir

Miguel Elendir

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 12 December 2012 - 04:19 PM

where I have to create this page?
Where should this page?



This is my controller:


class Pitufo extends Controller {
function __construct()
{
  parent::__construct();
 
  $this->load->database();
  $this->load->helper('url');
 
  $this->load->library('grocery_CRUD');
}


function noticias_management()
{
   $crud = new grocery_CRUD();
   $crud->set_table('Noticias');
   $crud->columns('not_titulo','not_descrip','not_fecha','not_ocultar','not_file');
   $crud->display_as('not_titulo','Titulo de la Noticia');
   $crud->display_as('not_descrip','Texto de la Noticia');
   $crud->display_as('not_fecha','Fecha de la Noticia');
   $crud->display_as('not_ocultar','Ocultar Noticia');
   $crud->display_as('not_file','Imagen Asociada');
   $crud->set_field_upload('not_file','img/news');

  
   $output = $crud->render();
  
   $this->_example_output($output);
}

Thanks for all

#5 victor

victor

    grocery CRUD Hero

  • Advanced Member
  • PipPipPip
  • 967 posts
  • LocationMinsk

Posted 12 December 2012 - 04:23 PM

Can explain this: I've changed model and control, removing "CI".

#6 victor

victor

    grocery CRUD Hero

  • Advanced Member
  • PipPipPip
  • 967 posts
  • LocationMinsk

Posted 12 December 2012 - 04:35 PM

In your case you should have this url:

http://your_site.com..._=1355333060290

Have a look at your url (on image).

#7 Miguel Elendir

Miguel Elendir

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 12 December 2012 - 04:37 PM

Yes, my version of Codeigniter is 1.7 and I need to change "class Pitufo extends CI_Controller" to "class Pitufo extends Controller"

#8 victor

victor

    grocery CRUD Hero

  • Advanced Member
  • PipPipPip
  • 967 posts
  • LocationMinsk

Posted 12 December 2012 - 04:41 PM

I didn't work with 1.7 version.
what is "Noti...te_file" in your url?
Is it method?

#9 Miguel Elendir

Miguel Elendir

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 12 December 2012 - 04:44 PM

Ulr of my imagen is : http://tahonasananto...dd457-new_2.png

#10 Miguel Elendir

Miguel Elendir

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 12 December 2012 - 04:46 PM

not_file is the field of table

#11 Miguel Elendir

Miguel Elendir

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 12 December 2012 - 04:49 PM

I'll update the version of my Codeigniter. I've tried it and I mention if I still have the same problem
Thanks

#12 victor

victor

    grocery CRUD Hero

  • Advanced Member
  • PipPipPip
  • 967 posts
  • LocationMinsk

Posted 12 December 2012 - 05:00 PM

show full url to your function

#13 Miguel Elendir

Miguel Elendir

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 27 December 2012 - 11:04 AM

After updating Codeigniter. Everything works correctly. Thanks for everything.

#14 Deeps

Deeps

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 10 March 2016 - 10:02 AM

same problem image not delete...... -_-

 

my controller:-

       
        $crud = new Grocery_CRUD();
        $crud->columns('story_id', 'name','partner_name','date_of_wedding','tell_story','photo',
                       'status','slug');
        
        $crud->display_as('story_id','Story Id');
        $crud->display_as('name','Name');
        $crud->display_as('partner_name','Partner Name');
        $crud->display_as('tell_story','Story');
        $crud->display_as('photo','Wedding Photo');
        $crud->display_as('status','Status');
        $crud->set_table('tbl_story');
        $crud->callback_column('date_of_wedding',array($this, 'callbackDob'));
        
        $crud->callback_after_insert(array($this,'story_slug'));
        $crud->callback_after_update(array($this,'story_slug'));
        $crud->callback_after_update(array($this, 'created_dtm_after_update'));
        $crud->callback_after_update(array($this,'callback_after_upload'));
    
        $crud->set_field_upload('photo',WEDDING_IMG_PATH);
        $crud->callback_after_upload(array($this,'callback_after_upload'));
    

        $crud->add_fields('name','partner_name','date_of_wedding','tell_story','photo','status');
        $crud->edit_fields('name','partner_name','date_of_wedding','tell_story','photo','status');
        $crud->required_fields('name','partner_name','date_of_wedding','tell_story','photo','status');
        $crud->order_by('created_dtm','dsc');
        $crud->field_type('date_of_wedding', 'date');
    
       
        $crud->set_subject('New Story');
        
        if($this->role == ROLE_SUBADMIN && $this->updations == ALLOW)
        {
            
            $crud->unset_upload();
            $crud->unset_delete();
            $crud->unset_add();
            $crud->unset_read();
        }
        else if($this->role == ROLE_ADMIN)
        {
            $crud->unset_read();
        
        }
        else
        {
            $crud->unset_delete();
            $crud->unset_add();
            $crud->unset_read();
            $crud->unset_edit();
            
        }
       
        $output = $crud->render();
        
        $this->storyOutput($output);
    
    }

function created_dtm_after_update($post_array,$primary_key)
         {
             $date_update = array(
                 "story_id" => $primary_key,
                 "created_dtm" => date('Y-m-d H:i:s')
             );
          
             $this->db->update('tbl_story',$date_update,array('story_id' => $primary_key));
          
             return true;
         }

       

 function callback_after_upload($uploader_response,$field_info, $files_to_upload)
{
    $this->load->library('image_moo');
 
    //Is only one file uploaded so it ok to use it with $uploader_response[0].
    $file_uploaded = $field_info->upload_path.'/'.$uploader_response[0]->photo;
 
    $this->image_moo->load($file_uploaded)->resize(800,600)->save($file_uploaded,true);
 
    return true;
}



#15 Isra

Isra

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 19 November 2018 - 02:48 AM

Ensure to set properly this variable on your config.php file

$config['index_page'] = 'index.php';

In my case I changed and now "delete" link is working fine.







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users