files not uploading
| From: | blackwater dev | Date: | Tue, 28 Sep 2004 14:24:32 +0000 |
| Subject: | files not uploading | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-198066@lists.php.net to get a copy of this message | ||
I just switched hosts and I am now working on all the stuff that once
worked but now doesn't. I have an image upload script with the
following code:
<form method='post' enctype='multipart/form-data'
action='<?=$_SERVER['PHP_SELF'];?>?method=upload&id=<? echo
$id?>'>
<?php
for( $i = 0; $i < $files_to_upload; $i++ )
{
?>
<tr>
<td colspan=5><input type='file' name='file[]'
style='width: 100%'></td>
</tr>
<?php
}
?>
<tr>
<td colspan=4 align='center'><input
type='submit' value='Upload'></td>
</tr>
</form>
Then, here is part of the code doing the upload:
<snip>
//When REGISTERED_GLOBALS are off in php.ini
$_POST = $HTTP_POST_VARS;
$_GET = $HTTP_GET_VARS;
//Upload the file
if($_GET['method'] == "upload")
{
echo "1<br>";
$file_array = $HTTP_POST_FILES['file'];
$uploads = false;
for($i = 0 ; $i < $files_to_upload; $i++)
{ echo "2<br>";
if($HTTP_POST_FILES['file']['name'][$i])
{ echo "3<br>";
</snip>
It prints out the 2 but doesn't get into the 3 loop....but I am
uploading files. I have tried it with $_FILES and $HTTP_POST_FILES.
This worked on my last hosts servers but not the new host. Any ideas?
Thanks!