
February 10th, 2013, 02:01 PM
|
|
Registered User
|
|
Join Date: Feb 2013
Posts: 8
Time spent in forums: 3 h 19 m 51 sec
Reputation Power: 0
|
|
|
PHP-General - Issue with $_FILES
Hi,
I have a strange issue in a script for uploading images.
I have a page to modify products.
The logic function of the page is that if I do not select the modification of the image product, the script "skip" the code to upload and continues with the rest of the script.
I put a check on $ _FILES after sending the form, but the result is
$ _FILES ['FleImage'] ['name'] is always NOT empty.
but print_r ($ _FILES) say to me that array is empty.
PHP Code:
echo"<pre>";
print_r($_FILES);
echo"</pre>";
$name = $_FILES['fleImage']['name'];
if (empty($name)) { echo "is empty";
}
else
{
echo "is not empty";}
then i created a simple test page with forms and controls equal to the original page:
PHP Code:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<form action="" method="post" enctype="multipart/form-data" name="prova">
<input name="fleImage" type="file" id="fleImage" class="box" multiple="multiple">
<input name="modify" type="submit" value="Modify Product">
</form>
<?php echo"<pre>";
print_r($_FILES);
echo"</pre>";
$name = $_FILES['fleImage']['name'];
if (empty($name))
{
echo "is empty";
} else {
echo "is not empty";} ?>
</body>
</html>
and this example works correctly!
Why?
|