Welcome Guest, Not a member yet? Register   Sign In
Upload Class mime/file_type fix for ZIP
#1

[eluser]codernow[/eluser]
Ok, so I had some problems when trying to upload zip files and it would give me the following error
Quote:The filetype you are attempting to upload is not allowed.

After some research and some packet sniffing I found the problem in config/mimes.php I added application/force-download to my zip entry and everything worked fine.

Code:
'zip'    =>  array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/force-download'),

This fix worked for CodeIgniter 1.7.2
#2

[eluser]Arockia Raj[/eluser]
Hi,

I tried the code in config/mimes.php

'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/force-download'),

But i can't upload the zip file.

Please help me.


Regards,
Arockia Raj
#3

[eluser]danmontgomery[/eluser]
The mime types that CI uses can vary depending on browser/platform. The 'bug' is not that the files won't upload (I wouldn't really call it a bug), it's a result of the way CI fetches mime types. Check the $_FILES array for the value of $_FILES['your_file_name']['type'] to see what you need to add to mimes.php. The $_FILES array will look something like this:

Code:
Array
(
    [file1] => Array
        (
            [name] => MyFile.txt
            [type] => text/plain // This is the value you want
            [tmp_name] => /tmp/php/php1h4j1o
            [error] => UPLOAD_ERR_OK
            [size] => 123
        )
#4

[eluser]Arockia Raj[/eluser]
Hi,

Thank you . it is working fine.



Arockia Raj




Theme © iAndrew 2016 - Forum software by © MyBB