⚠ 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

Problem uploading video



Kurushimi Toshiba
  • profile picture
  • Member

Posted 25 July 2013 - 21:16 PM

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 :(


davidoster
  • profile picture
  • Member

Posted 25 July 2013 - 23:42 PM

Hello and welcome to the forums [member=kurushimi toshiba].

 

1. Please check under application/config/ the file grocery_crud.php about these lines

$config['grocery_crud_file_upload_allow_file_types'] = 'gif|jpeg|jpg|png|tiff|doc|docx|txt|odt|xls|xlsx|pdf|ppt|pptx|pps|ppsx|mp3|m4a|ogg|wav|mp4|m4v|mov|wmv|flv|avi|mpg|ogv|3gp|3g2';
$config['grocery_crud_file_upload_max_file_size'] = '20MB';

Please amend these lines to your specific requirements. Make sure you change the max file size.

2. Check that the max file size value is equal or less <= than the value you have on your PHP configuration

3. Also you might need to check the max_execution_time setting