upload file is not working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • raj raj
    New Member
    • Nov 2011
    • 1

    upload file is not working

    below code give me the error when click the submit button

    Array ( [submit] => Submit ) Error: 1

    but the same code running on diff machine.can any body tell me the what is the problem


    <html>
    <body>

    <form action="" method="post"
    enctype="multip art/form-data">
    <label for="file">File name:</label>
    <input type="file" name="file" id="file" />
    <br />
    <input type="submit" name="submit" value="Submit" />
    </form>

    </body>
    </html>

    <?php
    //phpinfo();
    if(isset($_POST['submit']))

    {
    print_r($_POST) ;
    if ($_FILES["file"]["error"] > 0)
    {
    echo "Error: " . $_FILES["file"]["error"] . "<br />";
    }
    else
    {
    echo "Upload: " . $_FILES["file"]["name"] . "<br />";
    echo "Type: " . $_FILES["file"]["type"] . "<br />";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
    echo "Stored in: " . $_FILES["file"]["tmp_name"];
    }
    }
    ?>
  • zorgi
    Recognized Expert Contributor
    • Mar 2008
    • 431

    #2
    What do you mean by "diff machine" ?

    Is your script running on different servers or you accessed same server from different computers. In any case it probably has something to do that file you are trying to upload is exceeding maximum set in your php.ini for upload_max_file size

    Comment

    Working...