php server code

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
flashdisk
Forum Newbie
Posts: 2
Joined: Sat Nov 09, 2013 5:41 am

php server code

Post by flashdisk »

Hello everybody,

I am new to this forum and this is my first post :-)
I am having trouble in writing php code for simple server which take a zip file that contains alot of images from type png and the server should do the following:
1. open the zip file
2.read the name of every image in the file
3.send back a text file to the client-server application that contains the names of all pictures in the zip file

I have found many codes but I am a beginner in php coding , I need a guidelines and I would be grateful for any one who could help with that because I am tires of searching in the web and I thoutht this is the perfect place
to post.

thanks in advance
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: php server code

Post by Celauran »

What have you written so far? Where are you running into trouble? Do you think opening a zip file is a good idea?
flashdisk
Forum Newbie
Posts: 2
Joined: Sat Nov 09, 2013 5:41 am

Re: php server code

Post by flashdisk »

I have not written any thing yet because I am so confused with php and also this is my first time that I write something in php , I have read many tutorials but no one could give me the write answer to my case , and why it is not a good idea to open a zip file if there is any other way to extract the names of the images without opening it please show me that .

I have found this code dealing with zip files:

Code: Select all

<?php
$zip = new ZipArchive;
$res = $zip->open('test.zip');
if ($res === TRUE) {
    echo 'ok';
    $zip->extractTo('test');
    $zip->close();
} else {
    echo 'failed, code:' . $res;
}
?>
Post Reply