• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Video Uploading Problem

I have problem with uploading .flv and .mp4 files.

I have added in mimes.php

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

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

function  add_videos($lid,$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");


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


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

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

          ."<b>Video File</b><br>"

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


                      $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;" ;




  function do_add_videos($lid,$type){


        $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";

                   $data['my_box'] .="<a >";

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


                      $insert = array(
                       'lid' => "$lid" ,
                          'title' => "$title" ,
                         'video_type' => "local_file" ,

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

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





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

Hi Gewa
Just a quick question
Are the permissions of your upload directory (./images/lokale/videos) set to 777

I am making project on local server and its automaticaly writble. The image uploading works fine. So its not a problem of folder .

On a windows machine?

Yes on a Widnows machine. DENWER with APACHE PHP5,MYSQL5

[eluser]Michael Wales[/eluser]
Echo out the file_type key you receive from the data() method - depending on how your server is configured it may be using an incorrect mime type.

The fix - just add the mime type that gets echo'd out to that file extension's list of accepted mime types.

Hi Michael, thanks for your answer. But I don't know how to "Echo out the file_type key you receive from the data() method"...

can you give a code, which will do that, or where to read about it...

[eluser]Michael Wales[/eluser]
if ($this->upload->do_upload($field_name)) {
  echo '<pre>';
  echo '</pre>';

That will echo out all the info about the upload after the upload has been complete. Add that to your code, upload a file, utilize it to fix your mimetypes and delete the code out of controller.

Thank you michael. With 10000 tries I have solved problem in such way,

a) I added in my .htaccess file

AddType video/x-flv .flv
AddType video/mp4   .mp4

b) i added this mime types in /application/config/mimes.php

This solved the problem.

Thank you ALLLLLLL

[eluser]newbie boy[/eluser]
tried this solution, my flv file works perfectly but my mp4 not a single luck...

can anyone help me with this?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.