$_FILES array in PHP

Hi experts,

Coming back to my little project after time away, and I found an error.

Here's the form input

 
<label class="item_label">Select file:</label>
                <input type="file" id="filFileName" name="filFileName" accept=".pdf,.doc,.docx,.txt,.xls,.xlsx" style="width:25em; color: red;" <?=$disabled;?> />
                <label for="filFileName" id="fileLabel"></label>

Open in new window


and some code from the php processing it:
$file_types_array = array('doc', 'docx', 'xls', 'xlsx', 'pdf');
			$uploaded = (is_uploaded_file($_FILES['filFileName']['tmp_name'])) ? 'Upload File Present' : 'Upload File Not Present';

Open in new window


It is complaining that filFileName is undefined.  

Notice: Undefined index: filFileName in E:\xampp\htdocs7\includes\add_edit_validation.inc.php on line 68

Am I missing something obvious here?

Thanks for reading.

  Col
LVL 3
Colin BrazierAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brian TaoSenior Business Solutions ConsultantCommented:
Does it appear when you first first load the page? or after the HTTP POST?
Colin BrazierAuthor Commented:
After the post.
Brian TaoSenior Business Solutions ConsultantCommented:
Please paste your <form> tag.
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

Colin BrazierAuthor Commented:
This code
echo "<PRE>";
			print_r($_FILES);
			echo "</PRE>";
			exit();

Open in new window

shows the $_FILES array to be empty.

Maybe I wipe it out somewhere along the line?
Colin BrazierAuthor Commented:
<form name="form1" id="form1" action="" method="post">
Olaf DoschkeSoftware DeveloperCommented:
Check php.inin, if file_uploads= On and if you have a sufficient max size, there are both POST and FILE size limits.

Bye,  Olaf.
Colin BrazierAuthor Commented:
This has worked before with the same files.
Olaf DoschkeSoftware DeveloperCommented:
Well, you said "Coming back to my little project after time away". PHP.ini could have been changed in the meantime, couldn't it?

Bye, Olaf.
Colin BrazierAuthor Commented:
Interesting...filFileName turns up in the $_POST array:

Array
(
    [txtFileHeading] => new testuibbb
    [txtFileDescription] => test for adding
    [txtExistingFileName] => Copy of Fixtures 3-31oct2015.xlsx
   [filFileName] => 1. Council mins 27.09.15.pdf
    [radUpyesno] => 0
    [txtCategory] => newsletters
    [txtPosId] => 1
    [hdnID] => 63
    [btnSubmit] => Save
)
Colin BrazierAuthor Commented:
Well, you said "Coming back to my little project after time away". PHP.ini could have been changed in the meantime, couldn't it?

True.  I'll check it.
Olaf DoschkeSoftware DeveloperCommented:
The $_POST array always contains all form elements by name. It may also help you find out the temp name, but normally that isn't the true file name anyway.

If the $_FILES array really is empty, there has to be a reason for that in settings. If not PHP.ini then look into .htaccess files.

Bye, Olaf.
Colin BrazierAuthor Commented:
file_upload is on and post_max_size is 8M.  File size is 327kb
Colin BrazierAuthor Commented:
Changed form tag to

<form name="form1" id="form1" action="" method="post" encode="multipart/form-data" >

but no difference.

I will now be away for 2 hours or so.

Cheers
Olaf DoschkeSoftware DeveloperCommented:
How about trying a file name without a dot in it (aside of the one before the file extension of course)?

Bye, Olaf.
Brian TaoSenior Business Solutions ConsultantCommented:
It should be enctype="multipart/form-data" and not encode!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Colin BrazierAuthor Commented:
LOL, had another issue with json_encode today, so that's where that came from.

Thanks!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.