PHP file_upload

software development

#1

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”] . “
”;

Dizz.


#2

http://www.php.net/manual/en/features.file-upload.php
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.
Silk

My website


#3

@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.


#4

I found the problem - a simple GOTCHA -

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


#5

Ha ha…
I didn’t even notice that.
Silk

My website