PDA

View Full Version : UnRAR an uploaded file


chrisvmarle
09-02-2002, 05:25 PM
Is it possible to have users upload a RAR-archive wich is unpacked on the server so the files in it can be read by the following lines of the script?

Example:
I enter the page and see a little form with a file-select box (+ browse button) and a submit button.
I select a file "archive.rar" and click the submit button.

The file is being uploaded to the server and unpacked

Then I get to see a page with this information:
Your archive.rar contains 3 files:
text.txt of wich the text reads "This is a normal text file"
image1.jpg wich looks like this (resized to fit on page):
[IMAGE HERE] (<img src="(some_dir?!)/image1.jpg" width="80" height="60">)
image2.gif wich looks like this (resized to fit on page):
[IMAGE HERE] (<img src="(some_dir?!)/image2.gif" width="80" height="60">)

I hope I've made myself clear and there is someone who can help me on this :)

Thanks in advance
Mzzl, Chris

Spookster
09-02-2002, 08:39 PM
Probably not. Why not use zip files and utilize php gzip compression functions.

chrisvmarle
09-02-2002, 10:46 PM
I have a Sone Ericsson T68i (mobile phone) wich has the ability to use themes; these themese are named like "theme.thm". These .thm files are actually RAR files (if I rename it to theme.rar I can openit with a unRAR util.)

I want to give the visitors of my site the ability to upload a theme and then edit it on the page. (As I've seen on www.esato.com wich is unavailable at the time of writing this post :()

Mzzl, Chris

firepages
09-03-2002, 02:39 AM
what OS is your server ? most RAR utilities are win32 though I have seen some *NIX versions

& then I assume you could can call it with system() but I am guessing not ever having used rar.

chrisvmarle
09-03-2002, 08:28 AM
It doesn't matter wich OS you can get it to work.

If it's Windows, I'll host it myself
If it's *nix I'll upload to one of "my" other servers

Mzzl, Chris

firepages
09-04-2002, 03:05 AM
well read the docs to see what the commmand line options are and then run them via system...

system('c:\path\to\winrar.exe -e uploaded.rar c:\place\to\put_them');//syntax guessed from the winrar site

hopefully then you should have a directory with the extracted files ready to index.

there is probably a command switch which lets you retreive the contents of the archive - I dont know what that is!! but lets say '-get' (for example)

exec('c:\path\to\winrar.exe -get',$yaks);
foreach($yaks as $var){
echo $var."<br />\n";
}