Welcome Guest, Not a member yet? Register   Sign In
uploader mime type issues.. mp4 and flv
#1

[eluser]Jevedor[/eluser]
Okay so i have been developing a video upload app with CI and i have just realized that the mime config does not allow for mp4 or flv files. SO.... every time i try the upload i get the following error

The filetype you are attempting to upload is not allowed.

is the way to correct this by just adding the file types to mimes.php in the config folder?
if so what is the appropriate way to add it to the array. I've never been great with mime types. Also why was this over looked in the development of the mime array? It seems like flv and mp4 would be an obvious addition. Is their a reason i am missing that they were left out?
#2

[eluser]slowgary[/eluser]
I don't have much experience with CI file uploads, but the user guide mentions passing a config array when you load the upload class. One of the config items is the allowed file types. Have you set mp4 and flv as allowed?

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

I'm not so sure the mime type matters. With normal file upload forms you don't need to specify what type of file the user can attach, just that the form is multipart/data, so I'm guessing that you don't actually need the mime type to upload. Just guessing though.
#3

[eluser]Jevedor[/eluser]
Code:
$config['upload_path'] = '.'.$path;
$config['allowed_types'] = 'flv|mp4';
$config['max_size']    = '150000';
$config['overwrite'] = false;
$this->load->library('upload', $config);

unfortunately no that is not the issue. I have already passed the appropriate file types through the upload setup. I think whenever CI handles any type of mime it checks to see if its an authorized mime in the main config, /config/mimes.php. But i am speculating and don't know for sure.

this is the code that gets executed in the upload library

Code:
function mimes_types($mime)
    {
        global $mimes;
    
        if (count($this->mimes) == 0)
        {
            if (@require_once(APPPATH.'config/mimes'.EXT))
            {
                $this->mimes = $mimes;
                unset($mimes);
            }
        }
    
        return ( ! isset($this->mimes[$mime])) ? FALSE : $this->mimes[$mime];
    }

so im pretty sure i am guessing correct. I was hoping someone could confirm this. I was also hoping for the propper syntax to add it to the mime array. here is a snipit of what i am refering to.

Code:
'avi'    =>    'video/x-msvideo',
'movie'    =>    'video/x-sgi-movie',
'doc'    =>    'application/msword',
'word'    =>    array('application/msword', 'application/octet-stream'),
'xl'    =>    'application/excel',
'eml'    =>    'message/rfc822'

what is the propper way to include an flv and mp4?

Code:
'mp4' => ????????,
'flv' => ????????

i don't know there type definition.
#4

[eluser]TheFuzzy0ne[/eluser]
Code:
'flv' => 'video/x-flv',
'mp4' => 'video/mp4',
#5

[eluser]slowgary[/eluser]
Found these through google
Code:
'mp4' => 'video/mp4',
'flv' => 'video/x-flv',

EDIT: That's just not right.
#6

[eluser]Jevedor[/eluser]
Code:
AddType video/x-flv .flv

had to add this to my .htaccess as well. YAY it works now. only now im getting this CI error.

Unable to set file permissions. Please check your path. Note: This feature is only available in PHP 5 or higher.

I am set for php5 and i have 777 permissions on the upload folder.... hmmm i wonder if the path is coming in wrong.

I will research this.
#7

[eluser]Jevedor[/eluser]
correction to previous post. this is the proper way to add mp4s and flvs

Code:
'mp4'     =>     'video/mp4',
'flv'    =>    array('application/octet-stream','video/x-flv')

it is all working now
#8

[eluser]gibex[/eluser]
Had a similar issue with CSV file not being recognized in IE8 upload (same error).
Solution was to put MIME value shown here $this->upload->data['file_type'] in APP/config/mimes.php file under same file type.

thanks
#9

[eluser]Anak Indonesia[/eluser]
Cek your php.ini
set upload_max_filesize ....
example upload_max_filesize = 10M




Theme © iAndrew 2016 - Forum software by © MyBB