atk4 / atk4-addons

Agile Toolkit Addons
http://atk4.com/
Other
15 stars 23 forks source link

fix filestore upload #28

Closed herizo closed 11 years ago

herizo commented 11 years ago

mime_content_type is depreciated and not working for PHP 5.3+ so replaced by pecl finfo()

DarkSide666 commented 11 years ago

Related issue report: https://github.com/atk4/atk4-addons/issues/26

DarkSide666 commented 11 years ago

I believe it needs a bit more testing before merging. For example, to test if php_fileinfo.dll (for Windows) is enabled at all and stuff like that. Also if I understand correctly, then finfo_file() will return integer? and not string with mime_type. Need to check this before using.

herizo commented 11 years ago

hi imants, thank you for your comment, it is first time that i try to contribute for a project in github so it is a simple proposal and may need some improvements.

i've tested with two projects, one just for testing it and another project who use filestore addon and where we had problems.

pecl finfo library is not activated by default for windows only so users will need to activate it following php manual http://www.php.net/manual/en/ref.fileinfo.php

and last, i use finfo_open(FILEINFO_MIME_TYPE), so finfo_file() return a string with mime_type.

regards,

DarkSide666 commented 11 years ago

I see. Your commit is greatly appreciated and definitely will be merged in. I just want to be sure that Windows users (yeah, like myself) will not hung-up because of this :)

I guess I'll merge this in and then update it slightly with some IF something-goes-wrong THEN throw-error

DarkSide666 commented 11 years ago

I added some error checking too. Can you please test this? I just don't have time this weekend :(

herizo commented 11 years ago

ok, i will test :-)