⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Help uploading a file after deploying to GoDaddy



mztriz
  • profile picture
  • Member

Posted 10 December 2013 - 19:27 PM

I have a controller in CI which allows me to upload files to my database. It works fine locally. I setup CI on GoDaddy, changed permissions, changed database configs etc. 
 
Now when I try to upload a file, I can select the file and it gets to 100% uploaded -- but it doesn't save. Permissions on the directory files get uploaded to are 777 (for testing right now). I get the following in the webdev console:
 
  Error in event handler for (unknown): TypeError: Cannot read property 'state' of null
        at CSRecorder.onQueryStateCompleted (chrome-extension://cplklnmnlbnpmjogncfgfijoopmnlemp/content_scripts/recorder.js:45:13)
        at extensions::messaging:327:9
        at Function.target.(anonymous function) (extensions::SafeBuiltins:19:14)
        at Event.dispatchToListener (extensions::event_bindings:386:22)
        at Event.dispatch_ (extensions::event_bindings:371:27)
        at Event.dispatch (extensions::event_bindings:392:17)
        at dispatchOnMessage (extensions::messaging:294:22) extensions::event_bindings:375
    GET http://mywebsite.com/index.php/assets/uploads/files/dark_bg.png 404 (Not Found) jquery-1.10.2.min.js:4
    event.returnValue is deprecated. Please use the standard event.preventDefault() instead. 
I also get a popup that says:
"The page at mywebsite.com says: 6"
 
 
Here is the controller (again, it's working on my local Windows machine):
public function photo_upload()
        {
            try{
    
                $gc = new grocery_CRUD;
    
                $gc->set_table('photography')
                    ->set_subject('Image')
                    ->required_fields('image_path')
                    ->columns('image_path','image_name');
    
                $gc->set_field_upload('image_path','assets/uploads/files');
                $gc->unset_fields(array('image_date','image_extension'));
                $gc->change_field_type('image_name','invisible');
                $gc->callback_before_insert(array($this,'rename_image'));
    
                $output = $gc->render();
         
                $this->_example_output($output); 
            }catch(Exception $e){
                    show_error($e->getMessage().' --- '.$e->getTraceAsString());
                }       
        }


    function rename_image($post_array) 
        {
            if (!empty($post_array)) {
                //Remove image extension from image name
                $img_name = preg_replace('/\.[^.]+$/', '', $post_array['image_path']);
                //Remove codeigniter id from image name
                $img_name = substr($img_name, 6);
                $post_array['image_name'] = $img_name;
                return $post_array;
            }
        }