Error uploading files

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pplers
    New Member
    • Apr 2007
    • 60

    Error uploading files

    [PHP]<?
    if(empty($_POST )){ ?>
    <html>
    <body>
    <form method="POST" enctype="multip art/form-data">
    <input type="hidden" name="MAX_FILE_ SIZE" value="10240000 ">
    Archivo: <input type="file" name="arch"><br ><br>
    <center><inpu t type="submit" value="Subir Archivo"></center>
    </form>
    </body>
    </html> <?

    }else{
    $rn = $_FILE['arch']['name'];
    $tn = $_FILE['arch']['tmp_name'];

    if(is_uploaded_ file($tn)){
    if(move_uploade d_file($tn, $rn)){
    echo "Archivo "."<b>".$rn ."</b>"." subido";
    unlink($tn);
    }else{
    echo "Error al mover archivo ".$tn;
    }
    }else{
    echo "Error al subir archivo";
    }
    }

    ?>[/PHP]

    why doesn't it uploads the file i select ???

    it always prints Error al "subir archivo"

    in php.ini the maxsize is 32MB so that isn't the problem
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Try using:

    [code=php]
    print_r($_FILE) ;
    [/code]

    To make sure the file was uploaded properly. Especially pay attention to the 'error' index. You can look up the error code here.

    Comment

    • pplers
      New Member
      • Apr 2007
      • 60

      #3
      thanks, but the problem was very stupid:

      $_FILE xD --> while it should be $_FILES

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        *pause*

        Yes. That problem should be ashamed of itself!

        Heh.

        *grumble* wow HOW did I miss that one???

        Comment

        Working...