Ubuntu7.10+Apache2+PHP5 Files not uploading...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • clintec
    New Member
    • Mar 2008
    • 2

    Ubuntu7.10+Apache2+PHP5 Files not uploading...

    Ok...
    I've been trying to track this down between two "similar" systems (one that appears to work and the other that doesn't)... and I'm decided to ask for help.

    I have an Ubuntu 7.10 based system, with Apache2 + PHP5 installed, but when I attempt to implement even a SIMPLE file upload script, the files are not getting stored into the "/tmp" directory. I have validated that my maximum upload & post sizes are 10M... and I'm attempting to upload either a simple text file (helloworld.txt ) or a small 30kb jpeg and neither are placed into the /tmp directory. The filename for the /tmp directory is displayed from the upload_file.php script to the screen, but that file doesn't exist.

    Here is an example of the scripts:
    (upload.html)
    <html>
    <body>
    <form action="upload_ file.php" 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>

    --------------------------------------
    (upload_file.ph p)
    <?php
    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"];
    }
    ?>
    ------------------------------

    Any ideas?
    Thanks,
    Clintec.
  • clintec
    New Member
    • Mar 2008
    • 2

    #2
    Here is the output I get from attempting to post a small JPEG file.

    Upload: gdg.jpg
    Type: image/jpeg
    Size: 14.5869140625 Kb
    Stored in: /tmp/phpJCyUQl


    And unfortunately the file (/tmp/phpJCyUQl) doesn't exist.

    Any help would be appreciated.

    Comment

    • satas
      New Member
      • Nov 2007
      • 82

      #3
      /tmp/phpJCyUQl is a temporary name for uploaded file. You have to copy() it to other place.
      Read this:
      http://php.net/manual/en/features.file-upload.php

      Comment

      Working...