Upload script - not workin in IE 6

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thesti
    New Member
    • Nov 2007
    • 144

    Upload script - not workin in IE 6

    hi,

    i dunno why, but i have tested my upload script with IE 6. but the file wasn't uploaded. it works fine with Opera and FF. i use php 5.1.2

    here is my upload script

    [PHP]
    //get the picture file
    //validation on type and size
    $fileName = '';
    if(($_FILES['picture']['type'] == 'image/jpeg' || $_FILES['picture']['type'] == 'image/png')&& $_FILES['picture']['size'] < 3000000)
    {
    //user picture file name is the same with user key
    //get user key
    /*** query process ***/

    $fileName = 'sameWithUserKe y';

    //move the uploaded file
    move_uploaded_f ile($_FILES['picture']['tmp_name'], "../images/imgs/".$fileName );
    }
    [/PHP]

    though maybe something wrong with it.

    thx
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    I'm guessing you're trying to upload a jpeg because most images are jpeg, so here goes..

    IE being IE is a little bit poo and creates it's own unnecessary rules.

    try adding this to your if(imagetype ==) statement

    [php]
    if(($_FILES['picture']['type'] == 'image/jpeg'
    || $_FILES['picture']['type'] == 'image/png'
    || $_FILES['picture']['type'] == 'image/pjpeg') //*added this line
    && $_FILES['picture']['size'] < 3000000)
    [/php]

    * pjpeg is how IE recognises jpegs... stupid, eh?

    Hope this helps

    seasons greetings

    Comment

    • thesti
      New Member
      • Nov 2007
      • 144

      #3
      thx, markusn00b

      it works. haha, web programming and designing is challenging maybe because i'm in the process of learning. we have to test it on more than one browser.

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        Originally posted by thesti
        thx, markusn00b

        it works. haha, web programming and designing is challenging maybe because i'm in the process of learning. we have to test it on more than one browser.
        The process of learning is something you will never leave - and anyone else for that matter.

        Glad it works :)

        post back whenever you need to.

        Seasons greetings

        Comment

        Working...