MyBB Hacks

Full Version: Upload zip, rar in one folder specific and Extract zip, rar in one folder specific
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Hi.

I hope you help me, to know reply my question of PHP, but not for use in MyBB if not my interest own.
I've made one "Manga Online", But I'm updating it for the new version. ( http://www.sekai-manga.es/foro/mo/ ).I used MyBB for the templates.

And what I want to know how I can upload file "Zip" or "rar" and extract the images within a specific folder and later delete the "zip" or "rar" with PHP of course.

Off: My English is getting better, eh?
Just install unzip/unrar/7z and exec them.
How do I do that?
Extrar .zip:
<?php
$zip = new ZipArchive;
if ($zip->open('test.zip') === TRUE) {
    $zip->extractTo('/my/destination/dir/');
    $zip->close();
    echo 'ok';
} else {
    echo 'failed';
}
?>
(08-09-2011 02:58 PM)Gypaete Wrote: [ -> ]How do I do that?
That's for you to figure out.

PHP only has support for ZIP, not RAR.  You'll need to use the unrar executable for that.  How to do that will depend on many things, such as server setup/restrictions, so I'm not going to explain further.
From a PHP side, the general idea would be

PHP Code:
shell_exec('unrar x '.escapeshellarg($archive));

but of course, you need to have unrar installed.

How do I install Unrar?
You probably can't if you're on a shared server.  May depend though - you can try finding a binary copy and setting the executable flag to see if it works.  If you're on a shared server, you'll have to figure out how to do it.

If you have a VPS/dedicated you can just grab a copy from a repository.
Well, I don't know if it is shared. Yes I know that is not VPS. Another question, how do I create a folder on the FTP?

OFF: I'm doing a guide super in Spanish of Xthreads, and I wanted ask you permission. ¿I can?
(08-10-2011 09:01 PM)Gypaete Wrote: [ -> ]how do I create a folder on the FTP?

Do you mean creating a new directory using a ftp software?
Maybe depends on what ftp software you use.
You can try to right click on the directory where you want to create it.
Or, just create an empty folder on your computer, and upload it?
No, you're wrong RateU by PHP.
(08-11-2011 04:32 AM)Gypaete Wrote: [ -> ]No, you're wrong RateU by PHP.

Using mkdir?
Pages: 1 2 3
Reference URL's