Hello all!
I am new to Grocery Crud, but I find it awesome to work with! I've been on it for a couple of weeks, and I run in my first issue. I have a problem trying to upload video formats, and I don't if it is a bug maybe, or what could be happening.
This is my code:
$crud = new grocery_CRUD(); $crud->unset_jquery(); $crud->set_model($this->cms_module_path().'/grocerycrud_article_model'); $crud->set_language($this->cms_language()); $crud->set_table($this->cms_complete_table_name('article')); $crud->set_subject('Nota'); $crud->columns('video_url'); $crud->edit_fields('video_url'); $crud->add_fields('video_url'); $crud->display_as('video_url','Video'); $crud->set_field_upload('video_url', 'modules/blog/assets/uploads/videos'); $crud->callback_before_upload(array($this,'example_callback_before_upload')); $output = $crud->render();
And this is the callback function it is calling:
function example_callback_before_upload($files_to_upload,$field_info) { foreach($files_to_upload as $value) { $ext = pathinfo($value['name'], PATHINFO_EXTENSION); } $allowed_formats = array("mp4", "wmv", "avi", "mts", "flv", "mpeg", "mov", "txt"); if(in_array($ext,$allowed_formats)) { return true; } else { return 'Error'; } }
I added the 'txt' just to try, and turns out i can upload txt files, it's only the video formats that are not working. I've tried both mp4 and flv and nothing happens. On some cases I get my 'error' message. On other I get a popup window with a '1' in it. Other cases nothing happens but the video just won't upload and I get a white space.
I have searched the forum and seen that other people have had this same trouble. The solution given was to modify the .htaccess file, I have already tried that but it didnt do anything.
I have no idea what could be the problem :(