Upload zip, rar in one folder specific and Extract zip, rar in one folder specific
Gypaete Offline
Member
***
Posts: 82
Joined: Aug 2010
Post: #1
Upload zip, rar in one folder specific and Extract zip, rar in one folder specific
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?

[Image: selenab.png]
08-09-2011 01:02 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #2
RE: Upload zip, rar in one folder specific and Extract zip, rar in one folder specific
Just install unzip/unrar/7z and exec them.

My Blog
08-09-2011 02:54 PM
Find all posts by this user Quote this message in a reply
Gypaete Offline
Member
***
Posts: 82
Joined: Aug 2010
Post: #3
RE: Upload zip, rar in one folder specific and Extract zip, rar in one folder specific
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';
}
?>

[Image: selenab.png]
08-09-2011 02:58 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #4
RE: Upload zip, rar in one folder specific and Extract zip, rar in one folder specific
(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.


My Blog
(This post was last modified: 08-09-2011 04:10 PM by ZiNgA BuRgA.)
08-09-2011 04:08 PM
Find all posts by this user Quote this message in a reply
Gypaete Offline
Member
***
Posts: 82
Joined: Aug 2010
Post: #5
RE: Upload zip, rar in one folder specific and Extract zip, rar in one folder specific
How do I install Unrar?

[Image: selenab.png]
08-09-2011 10:01 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #6
RE: Upload zip, rar in one folder specific and Extract zip, rar in one folder specific
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.

My Blog
(This post was last modified: 08-10-2011 09:05 AM by ZiNgA BuRgA.)
08-10-2011 09:04 AM
Find all posts by this user Quote this message in a reply
Gypaete Offline
Member
***
Posts: 82
Joined: Aug 2010
Post: #7
RE: Upload zip, rar in one folder specific and Extract zip, rar in one folder specific
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?

[Image: selenab.png]
08-10-2011 09:01 PM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #8
RE: Upload zip, rar in one folder specific and Extract zip, rar in one folder specific
(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?

08-11-2011 04:05 AM
Find all posts by this user Quote this message in a reply
Gypaete Offline
Member
***
Posts: 82
Joined: Aug 2010
Post: #9
RE: Upload zip, rar in one folder specific and Extract zip, rar in one folder specific
No, you're wrong RateU by PHP.

[Image: selenab.png]
08-11-2011 04:32 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #10
RE: Upload zip, rar in one folder specific and Extract zip, rar in one folder specific
(08-11-2011 04:32 AM)Gypaete Wrote:  No, you're wrong RateU by PHP.

Using mkdir?

08-11-2011 07:06 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: