PHP file_upload

software development


I can’t get file upload working. Nothing in$_FILES after submit from this form:

Type (or select) Filename:

I guess that the file goes to my DOCUMENT_ROOT. But no file, no error, nothing. :frowning:

here’s a snippet of the processing code:
// POST has a file in uploadFile
if (isset($_POST[‘uploadFile’])) {
if ($_FILES[“file”][“error”] > 0) {
echo "Error: " . $_FILES[“file”][“error”] . “
} else {
echo "Upload: " . $_FILES[“file”][“name”] . “


Way down on the page it mentions that the $_FILES can be empty if the file size exceeds the post max size varible in the php.ini file. If you are using the default php the max file size is around 7mb.

My website


@silkrooster - thanks for that but my file is only 100kb.

I went back to basics and I can upload the file OK in a simple test program.

However, the original still shows no value set in $_FILES. I suspect it will be some silly programming error. I’ll dig around a while then post again if I don’t fix it.


I found the problem - a simple GOTCHA -

You must make sure your FORM tag has the correct enctype. E.g.


Ha ha…
I didn’t even notice that.

My website