image won't upload - i've checked form a dozen times

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

    image won't upload - i've checked form a dozen times

    I've the form you see below, which is supposed to upload an image. I
    expect the image name as a var to be $uploadedFile. In the receiving
    function, I've this code:
    global $uploadedFile, $uploadedFile_s ize, $uploadedFile_n ame;
    echo "here is the file name: $uploadedFile, $uploadedFile_s ize,
    $uploadedFile_n ame; <hr> ";
    $uploadedFile_n ame =
    $formatTextObje ct->processFileNam e($uploadedFile _name);
    $uploadedFile_n ame = htmlspecialchar s($uploadedFile _name);





    The line where I echo things out is just for debugging. I get the
    first 5 words, but no vars, nothing, no globals of that name are in
    global space. Below is the form. What am I missing?



    [color=blue][color=green][color=darkred]
    >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> >[/color][/color][/color]

    <form method="post" action="/mcControlPanel. php"
    enctype="multip art/form-data" class="mcForm">

    <input id="inputId1" type="hidden"
    name="formInput s[formSecurityRat ing]" value="associat e"
    class="hiddenIn put">





    <div class="formElem ent">
    Upload an image:
    <input type="file" name="uploadedF ile"><input type="hidden"
    name="uploadTyp e" value="image"></div>



    <div class="formElem ent">
    Type an easy to read name (as opposed to the file name) for this
    image:
    <div class="inputBox Title"><input id="inputId2" type="text"
    name="formInput s[cbHeadline]" value="" class="textInpu t">


    </div></div>



    <div class="formElem ent">
    Type a brief description:<br >
    <textarea id="inputId3" name="formInput s[cbMainContent]"
    class="textarea Input"></textarea>
    <p>HTML into symbols? <input type="checkbox"
    name="formInput s[usingHtml]" value="y" class="textarea Checkbox"></p>

    </div>




    <input type="hidden" name="formInput s[cbWhichType]" value="imageInf o">

    <input type="hidden" name="choiceMad e" value="standard ImageUpload">
    <input type="hidden" name="fileName" value="">
    <input type="submit" value="Click here when done" class="submitIn put">
    </form></div>
  • lawrence

    #2
    $_FILES empty after image upload [was Re: image won't upload ]

    I've now checked all the vars that I can think of. I'm working with a
    server running RH 9, PHP 4.2.3. YOu can see the whole form below.
    After upload, all the vars are empty, including $_FILES array. The
    image I'm trying to upload is 87k .

    What am I missing folks?




    <div class="onePanel ">
    <form method="post" action="/mcControlPanel. php"
    enctype="multip art/form-data" class="mcForm"> <input id="inputId1"
    type="hidden" name="formInput s[formSecurityRat ing]" value="associat e"
    class="hiddenIn put">
    <div class="formElem ent">
    Upload an image:
    <input type="file" name="uploadedF ile"><input type="hidden"
    name="uploadTyp e" value="image"></div>

    <input type="hidden" name="formInput s[cbWhichType]" value="imageInf o">
    <input type="hidden" name="choiceMad e" value="standard ImageUpload">
    <input type="hidden" name="fileName" value="">
    <input type="submit" value="Click here when done" class="submitIn put">
    </form></div>











    lkrubner@geocit ies.com (lawrence) wrote in message news:<da7e68e8. 0405051428.7a23 1301@posting.go ogle.com>...[color=blue]
    > I've the form you see below, which is supposed to upload an image. I
    > expect the image name as a var to be $uploadedFile. In the receiving
    > function, I've this code:
    > global $uploadedFile, $uploadedFile_s ize, $uploadedFile_n ame;
    > echo "here is the file name: $uploadedFile, $uploadedFile_s ize,
    > $uploadedFile_n ame; <hr> ";
    > $uploadedFile_n ame =
    > $formatTextObje ct->processFileNam e($uploadedFile _name);
    > $uploadedFile_n ame = htmlspecialchar s($uploadedFile _name);
    >
    >
    >
    >
    >
    > The line where I echo things out is just for debugging. I get the
    > first 5 words, but no vars, nothing, no globals of that name are in
    > global space. Below is the form. What am I missing?
    >
    >
    >
    >[color=green][color=darkred]
    > >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> >[/color][/color]
    >
    > <form method="post" action="/mcControlPanel. php"
    > enctype="multip art/form-data" class="mcForm">
    >
    > <input id="inputId1" type="hidden"
    > name="formInput s[formSecurityRat ing]" value="associat e"
    > class="hiddenIn put">
    >
    >
    >
    >
    >
    > <div class="formElem ent">
    > Upload an image:
    > <input type="file" name="uploadedF ile"><input type="hidden"
    > name="uploadTyp e" value="image"></div>
    >
    >
    >
    > <div class="formElem ent">
    > Type an easy to read name (as opposed to the file name) for this
    > image:
    > <div class="inputBox Title"><input id="inputId2" type="text"
    > name="formInput s[cbHeadline]" value="" class="textInpu t">
    >
    >
    > </div></div>
    >
    >
    >
    > <div class="formElem ent">
    > Type a brief description:<br >
    > <textarea id="inputId3" name="formInput s[cbMainContent]"
    > class="textarea Input"></textarea>
    > <p>HTML into symbols? <input type="checkbox"
    > name="formInput s[usingHtml]" value="y" class="textarea Checkbox"></p>
    >
    > </div>
    >
    >
    >
    >
    > <input type="hidden" name="formInput s[cbWhichType]" value="imageInf o">
    >
    > <input type="hidden" name="choiceMad e" value="standard ImageUpload">
    > <input type="hidden" name="fileName" value="">
    > <input type="submit" value="Click here when done" class="submitIn put">
    > </form></div>[/color]

    Comment

    • R. Rajesh Jeba Anbiah

      #3
      Re: image won't upload - i've checked form a dozen times

      lkrubner@geocit ies.com (lawrence) wrote in message news:<da7e68e8. 0405051428.7a23 1301@posting.go ogle.com>...[color=blue]
      > I've the form you see below, which is supposed to upload an image. I
      > expect the image name as a var to be $uploadedFile.[/color]
      <snip>

      Add the following 2 line in the beginning of your script and then retry.

      <?php
      ini_set('displa y_errors', 1);
      error_reporting (E_ALL);
      ?>

      --
      | Just another PHP saint |
      Email: rrjanbiah-at-Y!com

      Comment

      • lawrence

        #4
        Re: image won't upload - i've checked form a dozen times

        ng4rrjanbiah@re diffmail.com (R. Rajesh Jeba Anbiah) wrote in message news:<abc4d8b8. 0405052304.3c9e b52c@posting.go ogle.com>...[color=blue]
        > lkrubner@geocit ies.com (lawrence) wrote in message news:<da7e68e8. 0405051428.7a23 1301@posting.go ogle.com>...[color=green]
        > > I've the form you see below, which is supposed to upload an image. I
        > > expect the image name as a var to be $uploadedFile.[/color]
        > <snip>
        >
        > Add the following 2 line in the beginning of your script and then retry.
        >
        > <?php
        > ini_set('displa y_errors', 1);
        > error_reporting (E_ALL);
        > ?>[/color]

        I switched to a different web server and I tried your advice. Now the
        file name appears (see bottom line below), though the image is still
        not uploading. This server runs BSD and PHP 4.0.6. Can you think of
        any reason an older version of PHP might see the file name, while the
        other server, running 4.2.3 showed nothing?






















        Warning: Undefined variable: _POST in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 648

        Warning: Undefined variable: _GET in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 650

        Warning: Undefined variable: _ENV in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 652

        Warning: Undefined variable: _SERVER in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 654

        Warning: Undefined variable: _COOKIE in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 656

        Warning: Undefined index: arrayOfAllAllow edFunctions in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 638

        Warning: Undefined index: arrayOfAllAllow edFunctions in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 640

        Warning: Undefined index: arrayOfAllAllow edFunctions in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 642

        Warning: Undefined index: arrayOfAllAllow edFunctions in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 644

        Warning: Undefined index: arrayOfAllAllow edFunctions in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 646

        Warning: Undefined variable: _POST in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 648

        Warning: Undefined variable: _GET in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 650

        Warning: Undefined variable: _ENV in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 652

        Warning: Undefined variable: _SERVER in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 654

        Warning: Undefined variable: _COOKIE in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 656

        Warning: Cannot send session cache limiter - headers already sent
        (output started at /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php:638)
        in /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McSessionInfo.p hp
        on line 29

        Warning: Undefined index: McUsers in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 90

        Warning: Undefined index: controlPanelEve ntsMiddle in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 638

        Warning: Undefined index: controlPanelEve ntsMiddle in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 640

        Warning: Undefined index: controlPanelEve ntsMiddle in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 642

        Warning: Undefined index: controlPanelEve ntsMiddle in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 644

        Warning: Undefined index: controlPanelEve ntsMiddle in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 646

        Warning: Undefined variable: _POST in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 648

        Warning: Undefined variable: _GET in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 650

        Warning: Undefined variable: _ENV in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 652

        Warning: Undefined variable: _SERVER in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 654

        Warning: Undefined variable: _COOKIE in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 656

        Warning: Undefined index: arrayOfAllAllow edFunctions in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 638

        Warning: Undefined index: arrayOfAllAllow edFunctions in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 640

        Warning: Undefined index: arrayOfAllAllow edFunctions in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 642

        Warning: Undefined index: arrayOfAllAllow edFunctions in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 644

        Warning: Undefined index: arrayOfAllAllow edFunctions in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 646

        Warning: Undefined variable: _POST in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 648

        Warning: Undefined variable: _GET in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 650

        Warning: Undefined variable: _ENV in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 652

        Warning: Undefined variable: _SERVER in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 654

        Warning: Undefined variable: _COOKIE in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 656

        Warning: Undefined index: McUsers in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 90

        Warning: Undefined variable: _POST in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McUsers.php
        on line 125

        Warning: Undefined index: username in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McUsers.php
        on line 126

        Warning: Undefined variable: _POST in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McUsers.php
        on line 127

        Warning: Undefined index: password in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McUsers.php
        on line 128

        Warning: Undefined index: McTransactions in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 90

        Warning: Undefined index: McFormatText in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerFor All.php
        on line 90
        here is the file name: /var/tmp//phpt2tDZZ, 53264, corso1a.jpg;
        Warning: Undefined variable: absolutePath in
        /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppExtras/standardImageUp load.php
        on line 43

        Comment

        • R. Rajesh Jeba Anbiah

          #5
          Re: image won't upload - i've checked form a dozen times

          lkrubner@geocit ies.com (lawrence) wrote in message news:<da7e68e8. 0405060637.6f65 47b@posting.goo gle.com>...[color=blue][color=green]
          > > <snip>
          > >
          > > Add the following 2 line in the beginning of your script and then retry.
          > >
          > > <?php
          > > ini_set('displa y_errors', 1);
          > > error_reporting (E_ALL);
          > > ?>[/color]
          >
          > I switched to a different web server and I tried your advice. Now the
          > file name appears (see bottom line below), though the image is still
          > not uploading. This server runs BSD and PHP 4.0.6. Can you think of
          > any reason an older version of PHP might see the file name, while the
          > other server, running 4.2.3 showed nothing?[/color]

          http://in2.php.net/reserved.variables :
          Since PHP 4.1.0, the preferred method for retrieving
          external variables is with the superglobals mentioned
          below. Before this time, people relied on either
          register_global s or the long predefined PHP arrays
          ($HTTP_*_VARS). As of PHP 5.0.0, the long PHP predefined
          variable arrays may be disabled with the register_long_a rrays
          directive.

          [color=blue]
          > here is the file name: /var/tmp//phpt2tDZZ, 53264, corso1a.jpg;
          > Warning: Undefined variable: absolutePath in
          > /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppExtras/standardImageUp load.php
          > on line 43[/color]


          Few other guidelines:
          1. Always enable full error reporting
          2. Learn the art of debugging. Can be done with print_r($GLOBAL S)
          easily on >=4.1.0 for example.
          3. Try using Google <http://www.google.com/search?q=php+up load> and
          manual <http://in.php.net/features.file-upload>

          And here, it seems the file is getting uploaded to the upload
          directory (usually /tmp) as expected.

          --
          | Just another PHP saint |
          Email: rrjanbiah-at-Y!com

          Comment

          • lawrence

            #6
            Re: image won't upload - i've checked form a dozen times

            ng4rrjanbiah@re diffmail.com (R. Rajesh Jeba Anbiah) wrote in message[color=blue][color=green]
            > > I switched to a different web server and I tried your advice. Now the
            > > file name appears (see bottom line below), though the image is still
            > > not uploading. This server runs BSD and PHP 4.0.6. Can you think of
            > > any reason an older version of PHP might see the file name, while the
            > > other server, running 4.2.3 showed nothing?[/color]
            >
            > http://in2.php.net/reserved.variables :
            > Since PHP 4.1.0, the preferred method for retrieving
            > external variables is with the superglobals mentioned
            > below. Before this time, people relied on either
            > register_global s or the long predefined PHP arrays
            > ($HTTP_*_VARS). As of PHP 5.0.0, the long PHP predefined
            > variable arrays may be disabled with the register_long_a rrays
            > directive.
            >
            >[color=green]
            > > here is the file name: /var/tmp//phpt2tDZZ, 53264, corso1a.jpg;
            > > Warning: Undefined variable: absolutePath in
            > > /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppExtras/standardImageUp load.php
            > > on line 43[/color]
            >
            >
            > Few other guidelines:
            > 1. Always enable full error reporting
            > 2. Learn the art of debugging. Can be done with print_r($GLOBAL S)
            > easily on >=4.1.0 for example.
            > 3. Try using Google <http://www.google.com/search?q=php+up load> and
            > manual <http://in.php.net/features.file-upload>
            >
            > And here, it seems the file is getting uploaded to the upload
            > directory (usually /tmp) as expected.[/color]

            Thanks much for the tips. I hope I didn't waste your time. I did, of
            course, use print_r(), I thought that was in the example I posted, but
            perhaps not.

            But I'm still having the same trouble.

            You'll admit that print_r() isn't much use if the variable isn't
            registered. I'm getting nothing in $_POST and nothing in
            $HTTP_POST_VARS .

            I'm debuging on two machines. The BSD server running PHP 4.06 works
            fine, the images upload and the variables show up. But on the server,
            running RH Linux and PHP 4.2.3 I still don't get anything at all. I
            assume it's something in the ini file but I'm not sure what.

            By the way, I do respect the time of the people who here answer
            questions and so I always first run a search at groups.google.c om
            before I post a question. But I didn't see anything in the archives
            that explained a possible difference between two web servers, with
            setups similar to what I'm running.

            Comment

            • R. Rajesh Jeba Anbiah

              #7
              Re: image won't upload - i've checked form a dozen times

              lkrubner@geocit ies.com (lawrence) wrote in message news:<da7e68e8. 0405221203.12a9 6330@posting.go ogle.com>...
              <snip>[color=blue]
              > You'll admit that print_r() isn't much use if the variable isn't
              > registered. I'm getting nothing in $_POST and nothing in
              > $HTTP_POST_VARS .[/color]

              May be the IE bug <http://groups.google.c om/groups?selm=abc 4d8b8.040503215 4.67ac69f0%40po sting.google.co m>
              ??

              [color=blue]
              > I'm debuging on two machines. The BSD server running PHP 4.06 works
              > fine, the images upload and the variables show up. But on the server,
              > running RH Linux and PHP 4.2.3 I still don't get anything at all. I
              > assume it's something in the ini file but I'm not sure what.[/color]

              Couldn't you compare the two ini files?

              --
              | Just another PHP saint |
              Email: rrjanbiah-at-Y!com

              Comment

              Working...