This is a discussion on can't upload file to $_FILES within the PHP General forums, part of the PHP Programming Forums category; I'm trying to figure out why I can't upload a file in php. I'm trying it locally ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I'm trying to figure out why I can't upload a file in php. I'm trying it locally on a windows XP machine running Apache 2.2 and PHP 5.2.1. That is I am running the browser/server on same machine to test with. I also tried it on a remote linux server, though in that case I'm not sure what the s config settings where, except that it does have PHP and I get the same results. Are there any releevant apache settings ? I have not come accross any. Below is my script, results, and config settings. =------------------------------------------------------ <html> <body> <?php if ($_SERVER['REQUEST_METHOD'] == 'GET') { ?> <form enctype="mutlipart/form-data" method="post" action="<?php echo $_SERVER['SCRIPT_NAME'] ?>" > <input type="file" name="document"/> <input type="submit" value="Send File"/> </form> </body> </html> <?php } else { echo "FILE="; print_r($_FILES); echo "</br></br>POST="; print_r($_POST); } -------------------------------------------------------- on a post I get an empty $_FILES object and something in the $_POST variable from the above prints: FILE=Array ( ) POST=Array ( [document] => feedblitz.txt ) # my php config file has these settings which I also verified with phphinfo() ; Whether to allow HTTP file uploads. file_uploads = On ; Temporary directory for HTTP uploaded files (will use system default if not ; specified). upload_tmp_dir = "c:\play\soaptest"; ; Maximum allowed size for uploaded files. upload_max_filesize = 5M |