Hilfe beim Simplen Upload Script

Dieses Thema im Forum "Webentwicklung" wurde erstellt von BizzWare, 6. Februar 2007 .

Schlagworte:
  1. 6. Februar 2007
    Guten abend,

    ich bräuchte mal hilfe bei meinem upload script.
    Ich habe das Problem das er kein file uploaded bzw. ich sehe das er was uploaded, aber
    es is nich im verzeichniss drin
    Verzeichniss hat schon die Rechte 777

    ich bin schon seit einer halben stunde dran den fehler zu finden.

    bitte helft mir:

    dateien liegen wie folgt im ordner:

    /html/upload/ :
    index.php
    config.php
    und der ordner data is auch wie folgt drin
    /html/upload/data/

    PHP:
    <?
    include(
    "config.php" );

    switch (
    $_GET [ 'site' ]) {

        case 
    upload :
            
    $uploaddir  '/data/' ;
            
    move_uploaded_file ( $_FILES [ "uploadfile" ],  $uploaddir );
        break;

        case 
    checkpw :
            
    $password  md5 ( $_POST [ 'config_pw' ]);
            
            if (
    $password  ==  $upload_pw ) {
                echo 
    '
                    <form action="?site=upload" method="post">
                        <font size="2" face="tahoma">Send this file:</font> <input name="uploadfile" type="file">
                        <input type="submit" value="Send File">
                    </form>
                '
    ;
            }
            else {
                echo 
    '
                    <html>
                        <head>
                            <title>Upload-Site | Bizzware</title>
                            <meta http-equiv="refresh" content="2; url=index.php"> 
                        </head>
                        <body>
                            <center><font size="2" face="tahoma">Das Passwort ist Inkorrekt.<br> bitte noch einmal versuchen.</font></center>
                        </body>
                    </html>
                '
    ;
            }
        break;
        
        default:
            echo 
    '
                <html>
                    <head>
                        <title>Upload-Site | Bizzware</title>
                    </head>
                    <body>
                        <center>
                            <form action="?site=checkpw" method="post">
                                <font face="tahoma" size="2">Passwort:</font><br>
                                <input type="password" name="config_pw">
                                <input type="submit" value="ok">
                            </form>
                        </center>
                    </body>
                </html>
            '
    ;
        break;
    }

    ?>
    ich möchte keine verbesserungs vorschläge oder sonst etc. , ich möcht einfach nur wissen wo mein fehler ist ^^

    mfg BizzWare
     
  2. 7. Februar 2007
    AW: Hilfe beim Simplen Upload Script

    Guck dir mal deine case's an. Da liegt der Fehler.
     
  3. 9. Februar 2007
    AW: Hilfe beim Simplen Upload Script

    sry war in den letzten tagen viel beschäftigt

    nein sry ich find den fehler nich bin nich grad so nen php profi

    eher noch anfänger

    mfg BizzWare
     
  4. 9. Februar 2007
    AW: Hilfe beim Simplen Upload Script

    Code:
     case checkpw:
    Da fehlen die "". So erwartet PHP, dasses ne Variable is, da es aber ein String is, musses so heißen:
    Code:
     case "checkpw":
     
  5. 9. Februar 2007
    AW: Hilfe beim Simplen Upload Script

    ah okay ich werds mal testen danke schon mal
    bw is drin

    edit:

    funtzt noch immer nicht

    hier mal das script aufm space:

    klick hier

    pw: test
     
  6. 9. Februar 2007
    AW: Hilfe beim Simplen Upload Script

    Falsch. PHP erwartet eine Konstante. Existiert die nicht, wir der Konstantenname zum String.
    Ein wirklicher Fehler liegt da nicht, ist aber schlechter Stil.
     
  7. 9. Februar 2007
    AW: Hilfe beim Simplen Upload Script

    Naechster Fehler ist in deinem move_uploaded_file...
    PHP: move_uploaded_file - Manual (siehe Comments)

    BTW: Dein Passwortschutz ist sinnlos. Ich kann auch mit einem eigenen Formular ohne Passwort eine Datei hochladen, weil du in 'upload' nicht nach dem Passwort guckst.
     
  8. 9. Februar 2007
    AW: Hilfe beim Simplen Upload Script

    ja ich weiß das atm der pw schutzt nich gut is aber ich werde ihn auch noch umändern sobald das uploaden richtig funtzt

    danke schon mal an die restlichen

    werd mal schauen ob ich das problem lösen kann

    edit:
    also es klappt noch immer nicht der code sieht jetzt wie folgt aus:

    PHP:
    <?
    include(
    "config.php" );

    switch (
    $_GET [ 'site' ]) {

        case 
    "upload" :
            
    $uploaddir  $_SERVER [ 'DOCUMENT_ROOT' ]. "/upload/data/" ;
            
    move_uploaded_file ( $_FILES [ "uploadfile" ][ "tmp_name" ],  $uploaddir );
        break;

        case 
    "checkpw" :
            
    $password  md5 ( $_POST [ 'config_pw' ]);
            
            if (
    $password  ==  $upload_pw ) {
                echo 
    '
                    <form action="?site=upload" method="post">
                        <font size="2" face="tahoma">Send this file:</font> <input name="uploadfile" type="file">
                        <input type="submit" value="Send File">
                    </form>
                '
    ;
            }
            else {
                echo 
    '
                    <html>
                        <head>
                            <title>Upload-Site | Bizzware</title>
                            <meta http-equiv="refresh" content="2; url=index.php">
                        </head>
                        <body>
                            <center><font size="2" face="tahoma">Das Passwort ist Inkorrekt.<br> bitte noch einmal versuchen.</font></center>
                        </body>
                    </html>
                '
    ;
            }
        break;
        
        default:
            echo 
    '
                <html>
                    <head>
                        <title>Upload-Site | Bizzware</title>
                    </head>
                    <body>
                        <center>
                            <form action="?site=checkpw" method="post">
                                <font face="tahoma" size="2">Passwort:</font><br>
                                <input type="password" name="config_pw">
                                <input type="submit" value="ok">
                            </form>
                        </center>
                    </body>
                </html>
            '
    ;
        break;
    }

    ?> 
    mfg BizzWare
     
  9. 9. Februar 2007
    AW: Hilfe beim Simplen Upload Script

    Dein Fehler liegt nach wie vor an move_uploaded_file...
    Guck dir mal das 2. Argument an. Achja und du hattest oben geschrieben, BW raus. Also ich hab keine bekommen. Soll kein Betteln sein.
     
  10. 9. Februar 2007
    AW: Hilfe beim Simplen Upload Script

    sry aber ich check nich wo was falsch ist,
    bitte sagt mir den fehler
    und bw's sind jetzt raus
     
  11. 9. Februar 2007
    AW: Hilfe beim Simplen Upload Script

    Bei dir fehlt der File.
    PHP:
             $uploaddir  $_SERVER [ 'DOCUMENT_ROOT' ]. "/upload/data/" ;
    move_uploaded_file ( $_FILES [ "uploadfile" ][ "tmp_name" ],  $uploaddir );
    Setz mal an $uploaddir noch den Dateinamen ran.
     
  12. 9. Februar 2007
    AW: Hilfe beim Simplen Upload Script

    etwa so?
    PHP:
    $uploaddir  $_SERVER [ 'DOCUMENT_ROOT' ]. "/upload/data/" . $_FILES [ "uploadfile" ];
    move_uploaded_file ( $_FILES [ "uploadfile" ][ "tmp_name" ],  $uploaddir );
    sry wie gesagt bin noch 'n' anfänger ^^
     
  13. 9. Februar 2007
    AW: Hilfe beim Simplen Upload Script

    Adde mal
    PHP:
    var_dump ( $_FILES );
    Der Rest sollte sich selbst erklaeren
     
  14. 9. Februar 2007
    AW: Hilfe beim Simplen Upload Script

    ähm yo der gibt dann array(0) { } aus ^^
    und weiter weiß ich nich was ich machen soll ^^
     
  15. 9. Februar 2007
    AW: Hilfe beim Simplen Upload Script

    Es scheint so, als ob du gar keine Ahnung hast. Du hast bei deiner Form enctype="multipart/form-data" vergessen. So wird das nichts mit dem Upload...
     
  16. 9. Februar 2007
    omg ^^
    is mir jetzt irgendwie nen bissl peinlich ^^

    naya stimmt wo du es grad so sagst ^^
    ich depp
    naya danke dir ^^

    mfg BizzWare

    naya problem bleibt weiterhin bestehend
    er haut jetzt einfach nur ne datei innen ordner namens array
    hat auch keine endung nichts hab se mal mit einem editor geöffnet scheint der Quelltext vom bild zusein kanns aber nich exakt sagen obs er is

    ich hatte dann auch mal ["tmp_name"] weg gemacht er upt auch was aber es ist nichts im ordner

    edit: es ist der Quelltext der bild datei...

    mfg BizzWare
     
  17. Video Script

    Videos zum Themenbereich

    * gefundene Videos auf YouTube, anhand der Überschrift.