Hello, I'm using class.upload.php to upload pictures onto the server. Here is my form:
<form action="<?="http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];?>" method="post" enctype="multipart/form-data">
<table style="width: 100%; padding-top: 20px;">
<tr>
<td>Image file:</td>
<td><input type="file" name="image_file" /></td>
</tr>
<tr>
<td> </td>
<td align="right"><input type="submit" name="add_new" value="Add image" /><td></td>
</tr>
</table>
</form>
In php code I do:
if( array_key_exists('add_new', $_POST) )
{
echo 'add new is in array';
echo '<pre>';
print_r($_POST);
print_r($_FILES);
echo '</pre>';
$handle = new Upload($_FILES['image_file']);
...
}
Here is an output of print_r:
Array
(
[image_file] => somefile.png
[add_new] => Add image
)
Array
(
)
As you can see second array is empty ($_FILES), so image doesn't upload. Why?
- operating system : Linux
- PHP version : 5.2.12
- GD version : 2.0.34
- supported image types : png jpg gif bmp
- open_basedir : /home/httpd/vhosts/%site%/httpdocs:/tmp