Welcome Guest, Not a member yet? Register   Sign In
  Video Uploading Problem
Posted by: El Forum - 07-14-2008, 12:03 AM - Replies (11)

[eluser]Gewa[/eluser]
I have problem with uploading .flv and .mp4 files.


I have added in mimes.php

Code:
'flv' => 'video/x-flv',
                'mp4' =>'video/x-mp4',



here is 2 functions that should make upload, one is the form.

Code:
function  add_videos($lid,$type="step1"){






       if($type=="step1"){

              $data['my_box']   ="<center><b>Add Video-STEP1</b></center><br><br>";
                  $data['my_box']  .= anchor("/admin/places/add_videos/$lid/stream/","1.Streaming Video(YouTube or other)")."<br>";
                   $data['my_box']  .= anchor("/admin/places/add_videos/$lid/local_file/","2.Upload .FLV or MPG4");
                  }

        elseif($type=="local_file"){


            $attr = array(
              'name'        => 'file1',
              'id'          => 'username'

            );



            $data['my_box']   ="<center><b>Add Video(.flv and .mpg4 ONLY. max 15mb!!!)</b></center><br><br>"
        .form_open_multipart("/admin/places/do_add_videos/$lid/local_file")


          ."<b>Video Title</b><br>"
        ."&lt;input type=\"text\" name=\"title\"  size=\"40\"&gt;&lt;br>"





          ."<b>Video File</b><br>"
        .form_upload($attr)."<br><br>"





            ."&lt;input type=\"submit\" value=\" SAVECHANGES \"&gt;&nbsp;&nbsp;"

        ."&lt;/form&gt;";
                 }

         elseif($type=="stream"){
                      $data['my_box']   ="<center><b>Add Video-STEP2-STREAMING FROM OTHER SITES WITH EMBEDDING</b></center><br><br>";

                      $data['my_box']  .=  form_open_multipart("/admin/places/do_add_videos/$lid/stream")



                                     ."<b>Video Title</b><br>"
                                       ."&lt;input type=\"text\" name=\"title\"  size=\"40\"&gt;&lt;br>"

                                ."<b>Embedding Code </b><br>"
                                 ." &lt;textarea name=\"comment\" class=\"mceNoEditor\" cols=\"50\" rows=\"20\"&gt;&lt;/textarea><br><br>"

                                           ."&lt;input type=\"submit\" value=\" SAVECHANGES \"&gt;&nbsp;&nbsp;"

                                 ."&lt;/form&gt;" ;






         }














            $this->load->view('admin_panel',$data);







}


  function do_add_videos($lid,$type){
       $data['my_box']="";

     if($type=="local_file"){




        $config['upload_path'] = './images/lokale/videos';
               $config['allowed_types'] = 'mp4|flv|swf';


               $config['overwrite'] =FALSE;
             $this->load->library('upload', $config);




                   $data['my_box']="Results ";


             $field_name = "file1";
                 if($this->upload->do_upload($field_name)){


                   $data['my_box'] .="<a >";
                  $video_info=$this->upload->data();
                     $video_name=$video_info['raw_name'];


                   $data['my_box'] .="$video_name was uploaded successfuly <br>";

                      $title=$this->input->post('title');

                      $insert = array(
                       'lid' => "$lid" ,
                          'title' => "$title" ,
                         'video_type' => "local_file" ,
                         'video'=>"$video_name"
                      );

                    $this->db->insert('local_videos', $insert);

               }
                else{
               $data['my_box'].= "shajze";
                   $error=$this->upload->display_errors('<p>', '</p>');
                     $data['my_box'].=$error;


               }
















           }












           $this->load->view('admin_panel',$data);


  }

Why I get the file type you are trying to upload is not allowed?


  Example of Tinywebgallery with Codeigniter
Posted by: El Forum - 07-13-2008, 10:36 PM - Replies (17)

[eluser]babai[/eluser]
I need a example of Tinywebgallery(www.tinywebgallery.com) with Codeigniter. It's very urgent.


  CI & extjs
Posted by: El Forum - 07-13-2008, 08:52 PM - Replies (6)

[eluser]Unknown[/eluser]
Hi all, been lurking for a while, reading, learning and testing things out. I have been playing with ci for some time now, on & off.

I mainly program in VFP and have been trying to branch out to php. I have also played with javascript a bit, but not much at all. So the problem I have is that. I am trying to learn extjs within ci. I can create a form onto the browser, but my question is once I fill in the form and hit the submit button, how do I get that information into ci to be used?

Any help would be greatly appreciated
Thanks
Ron


  Custom, database-driven 404 page -- can this be improved?
Posted by: El Forum - 07-13-2008, 07:42 PM - Replies (8)

[eluser]arlodesign[/eluser]
Using the code from this forum post, I was able to pull off something I really wanted from my CodeIgniter application: if the first segment of the URI doesn't have a matching controller, send the request to a page controller and check for content in the page database. I did it by extending the Router.php library, as described in that post, and changing _validate_requests() as so:

Code:
show_404($segments[0]);

became

Code:
return array('page', 'index', $segments[0]);

Here's my page controller:
Code:
class Page extends Controller {
    
    function __construct()
    {
        parent::Controller();
        $this->load->model('Page_model');
    }
    
    function index($link)
    {
        $data['page'] = $this->Page_model->get_page($link);
        if (!$data['page']) show_404($this->uri->uri_string());
        $data['section'] = array(
            'title' => $data['page']['page_title'],
            'class' => $data['page']['page_link']
        );
        $data['page']['page_primary'] = markdown(smartypants($data['page']['page_primary']));
        $data['page']['page_secondary'] = markdown(smartypants($data['page']['page_secondary']));
        // print_r($data);
        $this->load->view('global/head_view', $data);
        $this->load->view('global/nav_view');
        $this->load->view('page_view');
        $this->load->view('global/foot_view');
    }
    
}

Here's where it gets interesting and I turn to you: I also wanted the content of my 404 page stored in the same pages database table so it could be edited by a user in an admin panel. So I created MY_Exceptions.php:

Code:
class MY_Exceptions extends CI_Exceptions {

    function MY_Exceptions()
    {
        parent::CI_Exceptions();
    }

    function show_404($page = '')
    {
        // Allows me to use information from database to make 404 page that matches site
        
        $CI =& get_instance();
        
        $CI->load->model('Page_model');
        $data['page'] = $CI->Page_model->get_page('404');
        $CI->output->set_header("HTTP/1.1 404 Not Found");
        $data['section'] = array(
            'title' => $data['page']['page_title'],
            'class' => $data['page']['page_link']
        );
        $data['page']['page_primary'] = markdown(smartypants($data['page']['page_primary']));
        $data['page']['page_secondary'] = markdown(smartypants($data['page']['page_secondary']));
        $CI->load->view('global/head_view', $data);
        $CI->load->view('global/nav_view');
        $CI->load->view('page_view');
        $CI->load->view('global/foot_view');
        echo $CI->output->get_output();

        log_message('error', '404 Page Not Found --&gt; '.$page);
        exit;
    }

My question to the always brilliant CodeIgniter community: My solution to this 404 thing feels like a total hack. I had to manually invoke the output class to get the views to appear and, worst of all, I had to reuse an entire block of code which I would have to change in two places should I need to make adjustments.

Any ideas on how I could improve on this idea? Can I actually call the page controller from the library item, or is that a terrible idea?

UPDATE: It should also be noted that, while I'm not a total n00b, my programming skills are somewhere between novice and intermediate. I apologize now if I follow up your kind answer with a bunch of seemingly stupid questions. Thanks. Wink

ANOTHER UPDATE: Fixed link to forum post in first paragraph.


  Hour from time field in mysql
Posted by: El Forum - 07-13-2008, 06:37 PM - Replies (1)

[eluser]neosable[/eluser]
Hi,

I wonder how do I print the Hour segment from a time field using CI from mysql table

mysql_to_unix doesnt seem to work with time fields only with date ones.

thanks


  Using models within models
Posted by: El Forum - 07-13-2008, 04:43 PM - Replies (9)

[eluser]vendiddy[/eluser]
Is it possible to load a model within a model? The following code (which is a method from a model) does not work. When I call $this->user_model, it is not defined. However, if I put 'user_model' and 'task_model' in the $autoload['model'] array then I can access the models without a problem. Am I doing something wrong?

Code:
function create_new()
    {
        
        //Make sure user is logged in
        $this->load->model('user_model');
        $user_id = $this->user_model->get_logged_in_user_id();
        if ($user_id === FALSE) {
            //User is not logged in
            return FALSE;
        }
        
        $this->load->model('task_model');
        $task = $this->task_model->create_new();
        $data = array(
            'title' => 'Title',
            'description' => 'A description.',
            'task_id' => $task->id,
            'creator' => $user_id,
        );
        $this->db->insert('projects', $data);
        $id = $this->db->insert_id();
        
        return $this->_get_project($id);    
    }

Thanks!


  Dynamically change language
Posted by: El Forum - 07-13-2008, 02:26 PM - Replies (4)

[eluser]MaDe[/eluser]
Hi,

I'm trying to create a multi-language website. I want to include the current language into the URI (eg. http://www.test.com/en/contact or http://www.test.com/de/help). I already wrote a router to cope with the extra URI segment and modified my controller constructors to read the URI and switch the language for all calls to $this->lang->load(..., $current_language).

But then I found the problem, that any messages from other parts of CI (validation) came out in the default language. How can I set the current language for *ALL* CI components at run-time?

Regards,
Marc


  Encoding characters problem
Posted by: El Forum - 07-13-2008, 12:34 PM - Replies (7)

[eluser]nuts[/eluser]
Hi !

I post this message because I have a problem with special characters on my webpage :\

I've configured my charset like this :
(in my pages)

Code:
&lt;meta http-equiv="Content-type" content="text/html; charset=UTF-8" /&gt;

In my config.php
Code:
$config['charset'] = "UTF-8";

In my database.php
Code:
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";



I read lots of topic about the problem, but don't manage to fix it :\
Usually I use an iso charset, but I didn't managed to make it work as I wanted, so I decided to use the UTF-8 charset. Not only I have to wrote all my spcial characters with their code like "&agrave;" to make it appear correctly on the static part of my pages .. but also, when I "edit" a message posted on my website, ... a message like "éàèç" become "éà çè" ...

I don't understand :\ the first time the message is resigtered in the database he is correctly registered, and next time, all my special characters are transformed :\
Moreover, the first post and the edition are made on the same webpage (I make appear a div to edit the message I want) so the charset is the same :\

Please help me I really don't understand this problem :\
Thanks


p.s. sorry for my english (I think I gonna write this sentence in my signature instead of making a p.s. every time I post :p)


EDIT : I've also tried to change the Interclassment of my text fields in my database (I tried latin1_swedish_ci, utf8_general_ci, ...)


  Validation across 3 forms
Posted by: El Forum - 07-13-2008, 11:58 AM - Replies (3)

[eluser]jt`[/eluser]
I'm currently following this tutorial on validation using CI's built-in validation class:

http://ellislab.com/codeigniter/user-gui...ation.html

That example assumes you only have one page for input. What if I want to spread it out over 3 pages?

Currently, I'm storing all POST variables inside of session variables, in order to remember user input as they fill out forms across 3 pages. I can explain the reasoning if necessary, but ultimately I'll want to WRITE to the database after the 3rd and final form page is submitted.

Each page should go through server-side validation, and I currently am doing that on form page 1, but when I try and follow the above tutorial for form page 2, I run into two problems:

1) My URL isn't updating, it's just showing www.fu.bar/register_step1 (when in reality, once the first form is fully validated, it should load the view AND the url www.fu.bar/register_step2)

2) I'm getting errors on form page 2 for fields, they look like this:

Undefined property: CI_Validation::$textLocationName_error
Message: Undefined property: CI_Validation::$textStreet_error
Message: Undefined property: CI_Validation::$textCity
Message: Undefined property: CI_Validation::$textCity_error

For #2: I'm trying to basically pre-populate the fields if the page reloads and not every field is validated. I'm showing errors right next to each element using this syntax:

&lt;?php echo $this->validation->textLocationName_error; ?&gt;

===

Could anyone chime in and help me do this form validation across multiple pages? I'm following the steps in CI's Form Validation almost verbatim, so that's what most of my code looks like.


  How to use the base_url(); function? - problem solved
Posted by: El Forum - 07-13-2008, 11:21 AM - Replies (3)

[eluser]mathew edison[/eluser]
Problem solved, my FTP client wasn't uploading properly -.-

Right I'm new to CodeIgniter and I'm loving it so far. I got a question about the base url function though because I'm using it like in the user guide however if I echo it the results on the page says "array" I was wondering how I could fix this.

Controller:

Code:
&lt;?php

class Home extends Controller {

    function Home()
    {
        parent::Controller();    
    }
    
    function index()
    {
        $this->load->helper('url');
        $this->load->view('welcome_message');
    }
}

/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */

View file:
Code:
&lt;?php

echo base_url();

?&gt;

sincerely
- Mathew


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Latest Threads
Array to HTML "Table"
by paulkd
3 hours ago
TypeError when trying to ...
by b126
4 hours ago
Webhooks and WebSockets
by InsiteFX
Yesterday, 10:39 AM
Retaining search variable...
by pchriley
Yesterday, 05:46 AM
Reading a session variabl...
by xanabobana
Yesterday, 05:05 AM
Update to v4.5.1, same us...
by kenjis
04-17-2024, 07:47 PM
Codeigniter 4 extend core...
by Semsion
04-17-2024, 05:08 AM
v4.5.1 Bug Fix Released
by lokman
04-16-2024, 02:12 PM
problem with textarea
by Nitin Arora
04-16-2024, 05:07 AM
Showing pdf on browser
by aarefi
04-16-2024, 04:38 AM

Forum Statistics
» Members: 84,544
» Latest member: ladyqueen
» Forum threads: 77,558
» Forum posts: 375,896

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB