Adblock breaks this site

problem with zip file with php

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

  1. fighter1431

    fighter1431 Forum Addict

    Joined:
    Feb 21, 2007
    Posts:
    418
    Referrals:
    0
    Sythe Gold:
    0
    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
     
  2. 'DnB'

    'DnB' Active Member
    Banned

    Joined:
    Apr 24, 2008
    Posts:
    145
    Referrals:
    0
    Sythe Gold:
    0
    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..
     
  3. sp for real

    sp for real Member

    Joined:
    Nov 17, 2011
    Posts:
    75
    Referrals:
    0
    Sythe Gold:
    0
    problem with zip file with php

< Looking for a templatep2p invite. | HTACCESS Writer >


 
 
Adblock breaks this site