Professional Web Applications Themes

file upload not showing up in /tmp linux - PHP Development

I'm having huge problems with a web server not putting the uploaded file in the /tmp here is my code can some one please point me in the right direction?I'm thinking i've done something with wrong with apache but can't find out what. ---- up.html ---- <HTML><BODY> <FORM method="POST" enctype="multipart/form-data" action="./up.php"> <input type="hidden" name="MAX_FILE_SIZE" value="1000000000"> <input type=file name=fupload> <INPUT type="submit"> </FORM> </BODY> </HTML> ---- up.html ---- ---- up.php ---- <HTML><BODY> <?php echo "main hi $fupload<BR>"; if( isset($fupload)){ echo "isset found hi $fupload_name<BR>"; } ?> </BODY> </HTML> ---- up.html ---- ---- output from a file uploaded of 120k---- <HTML><BODY> main hi ...

  1. #1

    Default file upload not showing up in /tmp linux

    I'm having huge problems with a web server not putting the uploaded
    file in the /tmp

    here is my code can some one please point me in the right
    direction?I'm thinking i've
    done something with wrong with apache but can't find out what.

    ---- up.html ----
    <HTML><BODY>
    <FORM method="POST" enctype="multipart/form-data" action="./up.php">
    <input type="hidden" name="MAX_FILE_SIZE" value="1000000000">
    <input type=file name=fupload>
    <INPUT type="submit">
    </FORM>
    </BODY>
    </HTML>
    ---- up.html ----


    ---- up.php ----
    <HTML><BODY>
    <?php
    echo "main hi $fupload<BR>";
    if( isset($fupload)){
    echo "isset found hi $fupload_name<BR>";
    }
    ?>
    </BODY>
    </HTML>
    ---- up.html ----


    ---- output from a file uploaded of 120k----

    <HTML><BODY>
    main hi <BR></BODY>
    </HTML>
    ---- output ----
    Jim Guest

  2. #2

    Default Re: file upload not showing up in /tmp linux

    Hi Jim,

    How PHP handle's uploaded files is quite different to normal variable
    submission (which isn't mentioned in the PHP doentation very well).

    $fupload won't be a variable containing the contents of the file you've
    uploaded, but an array of file information in the global $_FILES array
    (I donít code PHP with global variables on).

    So for:

    <FORM method="POST" enctype="multipart/form-data" action="./up.php">
    <input type="hidden" name="MAX_FILE_SIZE" value="1000000000">
    <input type="file" name="fupload">
    <INPUT type="submit">
    </form>

    To check if a person has selected a file, and submitted, then print the
    file contents out, you would require the following PHP (for example).

    <?php

    //
    // Check if a file has attached ('none' needed for IE compatability)
    //
    if ( (!empty($_FILES['fupload']['tmp_name']) ) &&
    $_FILES['fupload']['tmp_name'] != 'none' )
    {

    $file_content = addslashes(fread(fopen($_FILES['fupload']['tmp_name'],
    'r'), filesize($_FILES['fupload']['tmp_name']) )); // Read File

    echo $file_content; // Echo it

    }
    else
    {
    echo 'No file was submitted';
    }

    ?>

    Btw, $_FILES['fupload']['tmp_name'] returns the name/path of the file as
    it's temporarily stored on the servers FS, so having a

    echo $_FILES['fupload']['tmp_name'];

    would return something like

    /tmp/php8329x9

    Ovbiously in the $_FILES['fupload'], the 'fupload' corresponds to the
    name of the form file bit in your form, so you could have multiple
    uploads on the one form with $_FILES['fuploadwhatever'],
    $_FILES['fupload3'] etc.. corresponding to a:

    <input type="file" name="fupload3">
    <input type="file" name="fuploadwhatever">


    Hope this helps.
    Grant


    Jim wrote:
    > I'm having huge problems with a web server not putting the uploaded
    > file in the /tmp
    >
    > here is my code can some one please point me in the right
    > direction?I'm thinking i've
    > done something with wrong with apache but can't find out what.
    >
    > ---- up.html ----
    > <HTML><BODY>
    > <FORM method="POST" enctype="multipart/form-data" action="./up.php">
    > <input type="hidden" name="MAX_FILE_SIZE" value="1000000000">
    > <input type=file name=fupload>
    > <INPUT type="submit">
    > </FORM>
    > </BODY>
    > </HTML>
    > ---- up.html ----
    >
    >
    > ---- up.php ----
    > <HTML><BODY>
    > <?php
    > echo "main hi $fupload<BR>";
    > if( isset($fupload)){
    > echo "isset found hi $fupload_name<BR>";
    > }
    > ?>
    > </BODY>
    > </HTML>
    > ---- up.html ----
    >
    >
    > ---- output from a file uploaded of 120k----
    >
    > <HTML><BODY>
    > main hi <BR></BODY>
    > </HTML>
    > ---- output ----
    John Smith Guest

  3. #3

    Default Re: file upload not showing up in /tmp linux

    Absolutly Awesome thanks a ton.
    Jim Guest

Similar Threads

  1. Replies: 2
    Last Post: July 29th, 11:41 AM
  2. Upload Friendly (Multiple File Upload Applet)
    By ochiana in forum Coldfusion Server Administration
    Replies: 1
    Last Post: February 22nd, 02:16 AM
  3. Replies: 2
    Last Post: October 14th, 07:02 PM
  4. how to upload the .net application on linux server
    By Jerry III in forum ASP.NET General
    Replies: 0
    Last Post: August 4th, 09:01 PM
  5. how to upload an image selected from html file to flash file?
    By apple pie webforumsuser@macromedia.com in forum Macromedia Dynamic HTML
    Replies: 0
    Last Post: July 5th, 12:32 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139