Problem im IEX mit exec unzip

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • #16
    Okay, habsch.

    erst hat er mir eine Fehlermeldung bezüglich meines headers, also meiner weiterleitung zurück auf die ursprungsseite, gebracht. Hab ich behoben.

    Dann hab ichs nochmal probiert und es kam keine Fehlermeldung.

    Er legt wieder die Datei Bilder.zip im Zielordner an, diese ist aber 0 MB groß, also leer.

    PS: Im Firefox und im Opera gehts immernoch ohne jede Fehlermeldung und ohne jegliche Probleme ... falls das relevant ist

    Kommentar


    • #17
      Hast du endlich mal einen var_dump() von $_FILES gemacht und die Angaben bei gleicher Datei aber unterschiedlichen Browsern verglichen ?
      Und hast du dir mal die Rückgabe von exec() angeschaut und verglichen zwischen funzt und funzt nicht ?
      Zuletzt geändert von jahlives; 16.07.2007, 10:49.
      Gutes Tutorial | PHP Manual | MySql Manual | PHP FAQ | Apache | Suchfunktion für eigene Seiten

      [color=red]"An error does not become truth by reason of multiplied propagation, nor does truth become error because nobody sees it."[/color]
      Mohandas Karamchand Gandhi (Mahatma Gandhi) (Source)

      Kommentar


      • #18
        Firefox:

        array(1) { ["Datei"]=> array(5) {
        ["name"]=> string(8) "test.zip"
        ["type"]=> string(15) "application/zip"
        ["tmp_name"]=> string(14) "/tmp/phpvb8lKY"
        ["error"]=> int(0)
        ["size"]=> int(140959)
        } }

        Internet Explorer:

        array(1) { ["Datei"]=> array(5) {
        ["name"]=> string(8) "test.zip"
        ["type"]=> string(24) "application/octet-stream"
        ["tmp_name"]=> string(14) "/tmp/phpzaCTSh"
        ["error"]=> int(0)
        ["size"]=> int(0)
        } }


        Im IEX hat er Size=0, was mir sagt das die Datei leer ist. Das habe ich aber auch schon aus der hochgeladenen Datei selbst erschliessen können ...

        Der type ist anders ... ?

        Kommentar


        • #19
          Type solle egal sein...
          Welchen DOCTYPE hast du für das Form ? Hast du auch method="post" im Form ? Verwendest du html oder xhtml ?
          Bei selfhtml habe ich gelesen, dass
          Datei-Uploads funktionieren nur mit method="post". Wichtig ist außerdem, dass Sie im einleitenden <form>-Tag die Angabe enctype="multipart/form-data" notieren. Andernfalls erhalten Sie lediglich den Dateinamen der ausgewählten Datei übermittelt, nicht jedoch die Datei selbst.
          Gruss

          tobi
          Gutes Tutorial | PHP Manual | MySql Manual | PHP FAQ | Apache | Suchfunktion für eigene Seiten

          [color=red]"An error does not become truth by reason of multiplied propagation, nor does truth become error because nobody sees it."[/color]
          Mohandas Karamchand Gandhi (Mahatma Gandhi) (Source)

          Kommentar


          • #20
            Ich lese mal für dich.
            PHP-Code:
            echo "<form enctype=\"multipart/form-data\" method=\"POST\" action=\"kurz_zip/unzip.php\"> 
            Die Regeln | rtfm | register_globals | strings | SQL-Injections | [COLOR=silver][[/COLOR][COLOR=royalblue]–[/COLOR][COLOR=silver]][/COLOR]

            Kommentar


            • #21
              Wie mein Vorredner schon sagte:

              <form action="kurz_zip/unzip.php" method="post" enctype="multipart/form-data">

              Da gibts glaub ich keine Probs ... leider, denn dann wäre die Lösung ja einfach.

              Vieleicht liegt es an der Dateigröße irgendwie?! Wenn nur ein JPG in der ZIP ist gehts ja, wenn 2 oder mehr drinne sind, nicht.

              Ich habe doch aber mit

              <input type="hidden" name="MAX_FILE_SIZE" value="300000000">

              genug spielraum ...

              Kommentar


              • #22
                php.ini geprüft zum Thema MAX UPLOAD SIZE ? Mal phpinfo() bemühen... Aber eigentlich müssten dann alle Browser Probs machen
                Der MAX_UPLOAD aus dem Form sollte nicht das Problem sein, denn das wären doch 300 Mb und so grosse Bilder haste kaum. Aber hast du schonmal probiert den MAX_UPLOAD aus dem Form zu entfernen ? imho gibt es eh keine Browser die sich wirklich daran halten...

                Hast du ansonsten mal ein Online Bsp mit Link ?

                Gruss

                tobi
                Gutes Tutorial | PHP Manual | MySql Manual | PHP FAQ | Apache | Suchfunktion für eigene Seiten

                [color=red]"An error does not become truth by reason of multiplied propagation, nor does truth become error because nobody sees it."[/color]
                Mohandas Karamchand Gandhi (Mahatma Gandhi) (Source)

                Kommentar


                • #23
                  upload_max_filesize 20M

                  _REQUEST["MAX_FILE_SIZE"] 300000000

                  _POST["MAX_FILE_SIZE"] 300000000

                  ... müsste reichen.

                  Online Beispiel ist schwierig da man dort die komplette Homepage steuern kann. News, Produktlisten usw. Nich das ich hier jemandem misstraue, aber es gibt immer Leute die nichts gutes im Sinn haben ...

                  Kommentar


                  • #24
                    Original geschrieben von DDogg
                    Online Beispiel ist schwierig da man dort die komplette Homepage steuern kann. News, Produktlisten usw.
                    Dann stelle halt ein Beispiel bereit, mit dem man nicht "alles steuern" kann.
                    I don't believe in rebirth. Actually, I never did in my whole lives.

                    Kommentar


                    • #25
                      Falls kein Online Besipiel, dann doch wenigstens den gesamten Quelltext des Forms, so wie er im Browser ankommt
                      Gutes Tutorial | PHP Manual | MySql Manual | PHP FAQ | Apache | Suchfunktion für eigene Seiten

                      [color=red]"An error does not become truth by reason of multiplied propagation, nor does truth become error because nobody sees it."[/color]
                      Mohandas Karamchand Gandhi (Mahatma Gandhi) (Source)

                      Kommentar


                      • #26
                        okay, eine sekunde ...

                        Upload schript:

                        PHP-Code:
                        <?
                        include("shared_kurz.php");

                        echo "<table cellspacing=\"0\" cellpadding=\"0\" ><tr><td valign=\"top\">";
                        if ($Action == '')
                        {
                        echo"<b>Neue Produkte einpflegen</b>&nbsp;-&nbsp;Schritt 1<br>
                        <br><br>";


                        echo "<b>Für Welche Produktgruppe sind die Bilder?</b><br><br>";
                        ?>
                        <form action="kurz_zip/unzip.php" method="post" enctype="multipart/form-data">
                        <?
                        echo "<select name=\"tabelle\" size=\"\"><option value=\"0\">Bitte auswählen</option>";

                        connectkurz();

                        $sql33 = "select * from kurz_navi where tabelle > 0 order by tabelle DESC";
                        $res33 = send_sql($sql33);
                        $anzahl33=mysql_numrows($res33);
                        if ($anzahl33)
                          {
                            for ($b=0;$b<$anzahl33;$b++)
                            {
                            $tabelle=mysql_result($res33, $b, tabelle);
                            $Name=mysql_result($res33, $b, Name);

                            echo "<option value=\"$tabelle\" class=\"small\"><b>$Name</b></option>";

                            }}

                        echo "</select>";
                        ?>

                          <p>W&auml;hlen Sie eine Zipdatei von Ihrem Rechner aus:<br>
                          <input type="hidden" name="MAX_FILE_SIZE" value="300000000">

                            <input name="Datei" type="file" size="25">
                          </p>
                          <input type="Submit" name="Hochladen" value="Hochladen">
                        </form>
                        <?
                        echo "<br><br>";
                        }
                        else if ($Action == '1')
                        {
                        echo"<b>Neue Produkte einpflegen</b>&nbsp;-&nbsp;Schritt 2<br><br><br>";

                        echo "Die Datei wurde erfolgreich hochgeladen und entpackt!<br><br><br><br><br>";
                        }
                        ?>
                        Unzip Script

                        PHP-Code:
                         <?
                        error_reporting(E_ALL);

                        function send_sql_kurz($sql)
                        {
                          global $MySQL_Host, $MySQL_User, $MySQL_Passw, $MySQL_DB, $error;
                          if (! $res = mysql_db_query($MySQL_DB, $sql))
                          {
                            echo mysql_error();
                            exit;
                          }
                          return $res;
                        }

                            include("../shared_kurz.php");
                            connectkurz();

                        move_uploaded_file($_FILES['Datei']['tmp_name'], "Bilder.zip");

                         $zip_name = 'Bilder.zip';
                         exec('unzip -x '.$zip_name.' -d ./', $var );

                        $i=0;

                        $pfad="./";
                        $verz=opendir ($pfad);
                        while ($file=readdir($verz))
                        {
                            if (filetype($pfad.$file)!="dir")
                            {
                                $i++;

                                if ($file == 'unzip.php')
                                {}
                                else if ($file == 'Bilder.zip')
                                {}
                                else
                                {
                        copy($file,"../../kurz/Bilder/".$tabelle."/".$file);


                        $Grafikdatei = $file;

                        $Bilddaten = getimagesize($Grafikdatei);

                        $OriginalBreite = $Bilddaten[0];
                        $OriginalHoehe = $Bilddaten[1];
                        $ThumbnailBreite = 85;

                        if($OriginalBreite < $ThumbnailBreite)
                        {
                            $ThumbnailBreite=$OriginalBreite;
                        }

                        $Skalierungsfaktor = $OriginalBreite/$ThumbnailBreite;
                        $ThumbnailHoehe = intval($OriginalHoehe/$Skalierungsfaktor);


                        if($Bilddaten[2] == 2)
                        {
                            $Originalgrafik = ImageCreateFromJPEG($Grafikdatei);
                            $Thumbnailgrafik = ImageCreateTrueColor($ThumbnailBreite, $ThumbnailHoehe);
                            ImageCopyResized($Thumbnailgrafik, $Originalgrafik, 0, 0, 0, 0,
                         $ThumbnailBreite, $ThumbnailHoehe, $OriginalBreite, $OriginalHoehe);
                            ImageJPEG($Thumbnailgrafik, "TN".$Grafikdatei);

                            copy("TN".$Grafikdatei,"../../kurz/Bilder/".$tabelle."/TN".$Grafikdatei);


                            $lagernummer = substr($file, 0, -4);

                        $sql3 = "UPDATE kurz_$tabelle SET activ = '1' WHERE LagNr = '$lagernummer' LIMIT 1";
                        $res3 = send_sql_kurz($sql3);

                        $kleinesbild = "TN".$Grafikdatei;

                        unlink($kleinesbild);
                        unlink($file);


                        }


                                }
                                }}

                                header("Location:http:index.php?call=10&subcall=12&Action=1");
                        ?>
                        Zuletzt geändert von DDogg; 16.07.2007, 11:43.

                        Kommentar


                        • #27
                          HTML Quellcode !== PHP Quellcode. Da es eigentlich kein Serverprob sein kann interessiert der PHP Quelltext nicht die Bohne.
                          Rufe das Form auf, klicke mit Rechts drauf, wähle Quelltextansicht, markiere und kopiere alles und poste es hier.

                          Gruss

                          tobi
                          Gutes Tutorial | PHP Manual | MySql Manual | PHP FAQ | Apache | Suchfunktion für eigene Seiten

                          [color=red]"An error does not become truth by reason of multiplied propagation, nor does truth become error because nobody sees it."[/color]
                          Mohandas Karamchand Gandhi (Mahatma Gandhi) (Source)

                          Kommentar


                          • #28
                            Okay, sorry.

                            Ich erspar euch mal das was obendrüber steht, CSS formatierungen, die Navigation usw tun hier ja nichts zur Sache:

                            PHP-Code:
                            <table cellspacing="0" cellpadding="0" ><tr><td valign="top">
                            <
                            b>Neue Produkte einpflegen</b>
                            &
                            nbsp;-&nbsp;Schritt 1
                            <br><b>Für Welche Produktgruppe sind die Bilder?</b><br>
                            <
                            br>
                            <
                            form action="kurz_zip/unzip.php" method="post" enctype="multipart/form-data">
                            <
                            select name="tabelle" size="">
                            <
                            option value="0">Bitte auswählen</option>
                            <
                            option value="12" class="small"><b>Bücher und Platten</b></option>
                            <
                            option value="11" class="small"><b>Doppelsteine</b></option>
                            <
                            option value="10" class="small"><b>Einzelsteine</b></option>
                            </
                            select>

                              <
                            p>W&auml;hlen Sie eine Zipdatei von Ihrem Rechner aus:<br>
                              <
                            input type="hidden" name="MAX_FILE_SIZE" value="300000000">

                                <
                            input name="Datei" type="file" size="25">
                              </
                            p>
                              <
                            input type="Submit" name="Hochladen" value="Hochladen">
                            </
                            form>
                            <
                            br>
                            </
                            td>
                            <
                            td width=20></td>
                            <
                            td bgcolor="#E5E8EC" valign="top" width="123">
                            </
                            td></tr></table>

                            </
                            body>
                            </
                            html></td></tr></table
                            Hab ihn doch formatiert, hab nur nach dem ersten reinkopieren nicht gleich gesehen das das alles in einer Zeile steht ^^
                            Zuletzt geändert von DDogg; 16.07.2007, 12:02.

                            Kommentar


                            • #29
                              Der komplette Quellcode !!! d.h. inkl <html>,<head> und <body>
                              Und bei solchem
                              Code:
                              </body>
                              </html></td></tr></table>
                              Code brauchst du dich eigentlich nur zu wundern, dass es überhaupt funzen konnte

                              Gruss

                              tobi
                              Gutes Tutorial | PHP Manual | MySql Manual | PHP FAQ | Apache | Suchfunktion für eigene Seiten

                              [color=red]"An error does not become truth by reason of multiplied propagation, nor does truth become error because nobody sees it."[/color]
                              Mohandas Karamchand Gandhi (Mahatma Gandhi) (Source)

                              Kommentar


                              • #30
                                Bastel für dein Skript doch mal ein einfaches Formular ohne Formatierungen zum Testen.
                                Code:
                                <html>
                                  <head>
                                    <title>Testformular</title>
                                  </head>
                                  <body>
                                    <form action="kurz_zip/unzip.php" method="post" enctype="multipart/form-data">
                                      <input type="hidden" name="tabelle" value="12">
                                      <input type="hidden" name="MAX_FILE_SIZE" value="300000000">
                                      <input name="Datei" type="file" size="25">
                                      <input type="Submit" name="Hochladen" value="Hochladen">
                                    </form>
                                  </body>
                                </html>
                                Die Regeln | rtfm | register_globals | strings | SQL-Injections | [COLOR=silver][[/COLOR][COLOR=royalblue]–[/COLOR][COLOR=silver]][/COLOR]

                                Kommentar

                                Lädt...
                                X