File Upload Craziness

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ctiggerf

    #1

    File Upload Craziness

    I am having some troubles with file uploads on my server and was
    hoping you guys could help out.

    PHP is returning with the error UPLOAD_ERR_INI_ SIZE for all files over
    approx. 4Kb. I have set the upload_max_file size to 1Gb, and ini_get()
    reports that correctly.

    You can run my little sample script here: http://www.paramountlists.com/v3/ftp/cff_test2.php

    And now for the script:

    <?php error_reporting (E_ALL); ?>
    <html>
    <head>
    <title>Upload </title>
    </head>
    <body>
    <?
    if (!empty($_POST['upload'])) {
    echo "<pre>";
    print_r($_FILES );
    echo "</pre><br>";

    switch ($_FILES['myfile']['error']) {
    case UPLOAD_ERR_OK:
    echo "Upload was ok";
    break;
    case UPLOAD_ERR_INI_ SIZE:
    echo "Exceeds upload_max_file size:
    ".ini_get("uplo ad_max_filesize ");
    break;
    case UPLOAD_ERR_FORM _SIZE:
    echo "exceeds the MAX_FILE_SIZE." ;
    break;
    case UPLOAD_ERR_PART IAL:
    echo "The uploaded file was only partially uploaded.";
    break;
    case UPLOAD_ERR_NO_F ILE:
    echo "No file was uploaded.";
    break;
    case UPLOAD_ERR_NO_T MP_DIR:
    echo "Missing a temporary folder.";
    break;
    case UPLOAD_ERR_CANT _WRITE:
    echo "Failed to write file to disk";
    break;
    default:
    echo "Unknown File Error";
    }
    echo "<br>";
    }
    ?>
    <form method="post" enctype="multip art/form-data"
    action="<?php echo $_SERVER['PHP_SELF'];?>">
    <input type="hidden" name="MAX_FILE_ SIZE" value="5000000" >
    Upload File: <input name="myfile" type="file"><br >
    <input name="upload" type="submit" value="Submit"> </form>
    </body>
    </html>



    If you guys think this would be better asked at the apache newsgroup
    or something, let me know. I thought perhaps someone had run into the
    same trouble.

    Thanks,
    Chris F.

  • ctiggerf

    #2
    Re: File Upload Craziness

    On Apr 9, 9:41 am, "ctiggerf" <ctigg...@gmail .comwrote:
    I am having some troubles with file uploads on my server and was
    hoping you guys could help out.
    >
    PHP is returning with the error UPLOAD_ERR_INI_ SIZE for all files over
    approx. 4Kb. I have set the upload_max_file size to 1Gb, and ini_get()
    reports that correctly.
    >
    You can run my little sample script here:http://www.paramountlists.com/v3/ftp/cff_test2.php
    >
    And now for the script:
    >
    <?php error_reporting (E_ALL); ?>
    <html>
    <head>
    <title>Upload </title>
    </head>
    <body>
    <?
    if (!empty($_POST['upload'])) {
    echo "<pre>";
    print_r($_FILES );
    echo "</pre><br>";
    >
    switch ($_FILES['myfile']['error']) {
    case UPLOAD_ERR_OK:
    echo "Upload was ok";
    break;
    case UPLOAD_ERR_INI_ SIZE:
    echo "Exceeds upload_max_file size:
    ".ini_get("uplo ad_max_filesize ");
    break;
    case UPLOAD_ERR_FORM _SIZE:
    echo "exceeds the MAX_FILE_SIZE." ;
    break;
    case UPLOAD_ERR_PART IAL:
    echo "The uploaded file was only partially uploaded.";
    break;
    case UPLOAD_ERR_NO_F ILE:
    echo "No file was uploaded.";
    break;
    case UPLOAD_ERR_NO_T MP_DIR:
    echo "Missing a temporary folder.";
    break;
    case UPLOAD_ERR_CANT _WRITE:
    echo "Failed to write file to disk";
    break;
    default:
    echo "Unknown File Error";
    }
    echo "<br>";}
    >
    ?>
    <form method="post" enctype="multip art/form-data"
    action="<?php echo $_SERVER['PHP_SELF'];?>">
    <input type="hidden" name="MAX_FILE_ SIZE" value="5000000" >
    Upload File: <input name="myfile" type="file"><br >
    <input name="upload" type="submit" value="Submit"> </form>
    </body>
    </html>
    >
    If you guys think this would be better asked at the apache newsgroup
    or something, let me know. I thought perhaps someone had run into the
    same trouble.
    >
    Thanks,
    Chris F.
    Finally figured it out after another day of messing with settings ...
    apparently you can't set the upload_max_file size to 1G it has to be in
    M, so 1024M I guess.

    Comment

    Working...