uploading images from forms not working

Discussion in 'PHP' started by ppgpilot, Nov 28, 2007.

  1. #1
    I have renewed my computer after some problems with the hard drive –

    The problem – after reloading the computer with PHP 5, I cannot get html forms to upload images to a folder – in any of my php-based programs.

    It used to work… before the computer renewal .

    I have the same version of PHP as before and the same php.ini file.

    Any idea what could be preventing the $_FILES from working in files that used to work great?

    I suspect something in the php.ini, but just a feeing… Any thoughts???

    David
     
    ppgpilot, Nov 28, 2007 IP
  2. srobona

    srobona Active Member

    Messages:
    577
    Likes Received:
    57
    Best Answers:
    0
    Trophy Points:
    88
    #2
    r u sure that your html form is ok? please check for this:

    <form enctype="multipart/form-data">
     
    srobona, Nov 28, 2007 IP
  3. Jackel.ca

    Jackel.ca Well-Known Member

    Messages:
    108
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    128
    #3
    Permissions perhaps?
     
    Jackel.ca, Nov 29, 2007 IP
  4. ppgpilot

    ppgpilot Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yes, the form is right and the permissions are set to 777.

    When I "submit" the $_FILES['img1'][anything] cannot be found and the image is not loaded to the folder.

    Before I renewed the computer, it worked fine in every file on every program. Now it does not work on any file on any program which leasd me to think it is something in the system -- .ini, or something else that would affect a form upload.

    Any thoughts?

    David
     
    ppgpilot, Nov 29, 2007 IP
  5. dannet

    dannet Well-Known Member

    Messages:
    864
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    153
    #5
    Have you tried with $_FILES['img1']['anything'] instead $_FILES['img1'][anything]?

    You can try to debug it with error_reporting(E_ALL); and tell us if there are any error or notice after the form process...
     
    dannet, Nov 29, 2007 IP
  6. ppgpilot

    ppgpilot Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    thanks for your reply!

    I have tried placing ["xxxx"] and nothing

    I have error reporting on and nothing shows

    when the php is working the form data, I have it set as follows

    if($_FILES['img1']['size'] > 0)// test the file exists
    {

    if(($_FILES['img1']['type'] != "image/pjpeg") AND ($_FILES['img1']['type'] !="image/jpeg") AND ($_FILES['img1']['type'] !="image/jpg"))
    {

    $error_message .= "<br /><b>ENTRY ERROR!</b><br /> Images must be .jpg format<br /> <br />*******<br />
    Please Enter a .JPG Image</b><br /><br />";

    }

    if ($_FILES['img1']['size'] > 0)
    {
    $img= $_FILES['img1'];
    $img1 = myimgupload($img);
    }else{
    $img1 = 0;
    }


    }else{



    $img1 = 0;

    }


    $img 1 always enters the database as 0 -- nothing is loading for $_FILES[img1]

    This script has always worked - but now does not on my local server - still works on the uploaded files on the main server - so i know it is working - also, all files on all my local sigtes are affected in the same way...



    David
     
    ppgpilot, Nov 29, 2007 IP
  7. krampus

    krampus Active Member

    Messages:
    29
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    88
    #7
    maybe is the problem with the path to the folder you are uploading.

    While configuring my Apache server on local, I always make two folders, one for the UPLOAD files and one for the SESSIONs.. and write those paths in the php.ini file.

    Did you try that?
     
    krampus, Nov 29, 2007 IP