problem with zip file with php

Discussion in 'Web Programming' started by fighter1431, Oct 7, 2009.

problem with zip file with php
  1. Unread #1 - Oct 7, 2009 at 4:55 AM
  2. fighter1431
    Joined:
    Feb 21, 2007
    Posts:
    418
    Referrals:
    0
    Sythe Gold:
    0

    fighter1431 Forum Addict

    problem with zip file with php

    I haev some problems with the code for my website that is suppossed to extract a zipfile and then put al lthe names of the entries in a mysql databse.

    Could someone please tell me what I did wrong and correct this code?

    Code:
           elseif ($_POST['nieuwefotosubmit']) {
    
                   $file = $_FILES['file']['name'];
                   $fileplaats = "fotos/".$file;
    
                   $target_path = "fotos/";
                   $target_path = $target_path . basename( $_FILES['file']['name']);
                   $move1=move_uploaded_file($_FILES['file']['tmp_name'], $target_path);
                   $error = $_FILES['file']['error'];
    
                   if (!$move1) {
                           $content = "Het is niet gelukt om ".$file." te uploaden <br
    />".$error."<br />";
                   } else {
                           $content .= "Het is gelukt om ".$file." te uploaden.<br />";
                   }
    
                   if(!$include=include_once("pclzip.lib.php")) {
                           die('Error'.$include->errorInfo(true));
                   }
                   $zip =  new PclZip($fileplaats);
                   if (($lijst = $zip->listContent()) == 0)
                   die ('Error '.$zip->errorInfo(true));
    
                   $i = 0;
                   while ($i < sizeof($lijst)) {
    
                           $naam = $lijst[$i]['filename'];
                   $fotograaf = $login;
                           $comment = "";
                           $query200 = mysql_query("INSERT INTO fotos (naam, date, comment,
    fotograaf) VALUES ('$naam', '$date', '$comments', '$login')");
    
                           $error = mysql_error();
    
                           if (!$query200) {$content = $error;}
    
                   }
           }
    
    thx in andvance

    fighter1431
     
  3. Unread #2 - Oct 12, 2009 at 6:08 PM
  4. 'DnB'
    Joined:
    Apr 24, 2008
    Posts:
    145
    Referrals:
    0
    Sythe Gold:
    0

    'DnB' Active Member
    Banned

    problem with zip file with php

    What error does PHP produce when you attempt to run this?

    Looks like you just cut this section out of something bigger..
     
  5. Unread #3 - Nov 19, 2011 at 11:13 AM
  6. sp for real
    Joined:
    Nov 17, 2011
    Posts:
    75
    Referrals:
    0
    Sythe Gold:
    0

    sp for real Member

    problem with zip file with php

< Looking for a templatep2p invite. | HTACCESS Writer >

Users viewing this thread
1 guest


 
 
Adblock breaks this site