Tag: rar
Adding RAR to allowed upload types of wordpress
by z3n on Mar.26, 2010, under Tips & Hints
Problem:
I can’t upload rars to wordpress.
Solution:
Edit wp-includes/functions.php,
search for:
'exe' => 'application/x-msdownload'
add a line after it:
'rar' => 'application/x-rar-compressed',
Done!
You may want to add other filetypes you also enjoy here.
Source:
Installing RAR Support for PHP on Fedora/Linux
by z3n on Apr.25, 2009, under Linux Happyness
Problem:
php has no support to rar on fedora, there’s no yum pack for easy install.
Solution:
packs you will need:
php-devel gcc-c++
one line install: (version might differ!)
wget http://pecl.php.net/get/rar;mv rar rar.tgz;tar -xzvf rar.tgz;cd rar-1.0.0;phpize;./configure && make && make install;
don’t forget to add:
extension=rar.so
on your php.ini
PHP to extract and delete compressed files (rar/zip)
by z3n on Mar.11, 2009, under Coding
Problem:
After downloading massive stuff on the internet you need to do the boring process of extracting then deleting the compressed files from multiple folders etc etc
Solution:
A php script that extract all rar/zip files into all subfolders from the root folder you specify.
How to use:
on prompt:
php x.php /path/to/folder
if you are on windows it’s recommended that you put x.php on a folder before the ones you want to process, or at least into the same drive letter.
Note: Must have php_zip and php_rar libraries enabled on your php.ini
Note2: Apparetly there’s a bug on the php_rar library, even if i close the handler or even unset the object, the last file of a rar archive keeps being used, meaning that script can’t delete it, so you need to do it manually (you will need to wait the script finish uncompressing of all the subfolders before deleting).