views:

11

answers:

2

The file I'm uploading is either not getting written into the temporary folder or is it not getting processed by PHP properly.... Enctype - Check Name, Method - Check Form (syntax) - Check (Take it from me that the data is being passed by the form to the PHP) The PHP code - 0) { echo "Return Code: " . $_FILES["file"]["error"] . "
"; } else { echo "Upload: " . $_FILES["file"]["name"] . "
"; echo "Type: " . $_FILES["file"]["type"] . "
"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb
"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "
";
if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; } } } else { echo "Invalid file"; } ?>
PHP - Filesize - Check Php.ini file - Check File Permissions - Check.

Output- Invalid File And i don't get any error as well. Please Help!!

And one more thing if it helps - When i print_r($_FILES) i get this following output - Array ( [logo] => Array ( [name] => pixel.gif [type] => image/gif [tmp_name] => E:\sAi\Web Design EC\upload\php34.tmp [error] => 0 [size] => 4271 ) ) But when i just do an echo echo $_FILES["file"]["name"] it gives NO output. Hope the problem is clear, any help is greatly appreciated.

A: 

Well it seems that the name of file attribute in your form is logo and you are using file in php

i.e: you are using as $_FILES['file'] where as you should use $_FILES['logo'].

Or You can change name of file element "logo" to "file" in your html form.

Yogesh
A: 

Ahhhh, i knew i was making a silly mistake! Thanks a lot dude!

Susagittikasusa
You can mark @Yogesh's answer as accepted using the check mark.
Pekka