You are here: Re: $_FILE variables returning null when in body of page. « PHP Programming Language « IT news, forums, messages
Re: $_FILE variables returning null when in body of page.

Posted by bill on 11/25/06 00:46

NC wrote:
> bill wrote:
>> I wrote a test script to upload files. In the php section above
>> the page I get the expected content of the $_FILES array.
>>
>> When I have a php section in the body, the $_FILES array
>> variables return nothing.
> ...
>> Any suggestions as to why I get the null returns from the
>> $_FILE array ?
>
> I would guess, there's something wrong with the form you are
> using to upload files. Most likely, you forgot to specify
> enctype="multipart/form-data" in your form definition...
>
> Cheers,
> NC
>

Actually the file uploads fine, the $_FILES array gets loaded and
will display the values in the script that lives above the
webpage code. The $_FILES array returns null values when I have
a section of php in the body of the page.
here is some of my code:---------------------
<?
echo "The array<br />";
print_r($_FILES);
echo "<br />--------------------------------";
echo "<br />temp-name-php:";
echo $_FILES["test-img"]["tmp_name"];
echo "<br />name-php:";
echo $_FILES["test-img"]["name"];
echo "<br />---------------------<br />";
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=us-ascii" />
<title>do test upload</title>
</head>
<body>
<p>test file upload-5</p>
<p>
temp name-> <? echo $_FILES["test-img"]["tmp_name"] ?> <br />
name -> <?php echo $_FILES["test-img"]["name"]; ?> <br />
size -> <?php echo $_FILES["test-img"]["size"]; ?> <br />
type -> <?php echo $_FILES["test-img"]["type"]; ?> <br />
</p>
</body>
</html>
--------------------------------
the $_FILES vars in the body return blank or null values

bill

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация