Hi all!

I have a really strange problem - when I use this test-code and submit the form, there is nothing in any of the "print_r"ed variables -> Array ( ) Array ( ) Array ( ):

<?
print_r($HTTP_POST_FILES);
print_r($HTTP_POST_VARS);
print_r($_FILES);
?>
<html>
<form name="form" enctype="multipart/form-data" method="POST" action="test.php">
<input type="file" name="file" class="content" size="40">
<input type="hidden" name="testing" value="123456789">
<input type="submit" name="upload" value="Upload">
</form>
</html>

If I remove the enctype="multipart/form-data" there is at least something in $HTTP_POST_VARS.
Is it possible to enable/disable "multipart/form-data" in php.ini ? Might a misconfiguration be the problem or something else ?

Thanks a lot in advance for any hints!

Best regards,
Hannes.

    Hi,

    please post your php.ini (as attachment). Which browser do you use ? Besides that, your HTML code is missing the head and body parts. I tested exactly your code on two servers and it worked without any problems.

    You need enctype="multipart/form-data" in order to successfully upload files so the problem must be somewhere else.

    Thomas

      Hi Thomas!

      Thanks a lot for your reply!!!

      Find attached the php.ini.

      I use IE6 and Moz1.7 - the script doesn't work on both.

      Thanks a lot again,
      Hannes.

        Looks ok so far ... add

        error_reporting(E_ALL);

        on top of your script just after the <?

        Also try to specify the temporary upload directory in php.ini (it's commented out)

        upload_tmp_dir = /tmp

        But I don't think that this is the problem.

        Which PHP version is installed ? Doesn't it work at all or with big files only ?

        Thomas

          Hi Thomas!

          Thanks a lot for your help!

          It works now again :-)

          I add upload_tmp_dir = /tmp - then it worked ... just being curious, I removed it again and it works too...
          Does PHP detect changes in php.ini from file-time and then reloads the config when it's changed ?
          But that can't be a good reason anyway, because I restarted apache several times since yesterday...

          Thanks again,
          Hannes.

            Hi,

            glad to hear that the problem is solved 🙂

            AFAIK PHP doesn't reload the php.ini file while running if it has changed. I think, you need to restart/reload the web server if php.ini has been modified.

            Thomas

              Write a Reply...